Overview
This project was designed to allow me to create a HAMA bead copy of any image. This project used Python3 with modules TkInter and PILLOW/PIL, as well as other software, such as GIMP (open source image editor software) to resize the images.
Step 1 - Create a color class to store colours.
Color class
|
Create a dead simple class to store any colour values of the HAMA beads.
Note: I do spell 'colour' with a 'u', but for the purposes of programming, I follow the trend of discarding the 'u' (much as it hurts to do so!). |
Step 2 - Find the colours of all the HAMA beads
Array of colours
|
It turns out that finding an official list of bead colours in hexadecimal is insanely hard. To spare you the trouble, there is an document here, which lists every colours of every make of pearl, along with the colours. I just used non-transparent ones (that's all I have), but feel free to use any others.
The second part of the code is to fix an error with the colours I found on the internet. Since the hexadecimal colours are slightly too light (black is (46,47,49) or dark grey), I added a darkening variable in order to make all the pixels darker, and so create more contrast in the final image (before large parts would just go black). |
Step 3 - Make a piece of code to decide on the best colour
The colour-picker code
|
This is the most important bit of the entire code. In order to make the software work, the best colour must be found for every pixel of the image.
The program also contains a randomness generator, to add a bit of texturing to the image. Whilst this makes the code more confusing, it makes for a much better overall image. |
Step 4: Read the image
Read an image
|
This bit of code opens an image file and creates a matrix of all the pearl colours that are needed to make a pearl image of it. This is all the project actually needs, but a user-interface is nice.
|
Step 5: Create TkInter UI for the program
User Interface Code
|
Finally, create an onmousemove function, so that the user can interact, and build a very simple TkInter User Interface for it.
|
Full Code
Please do not use for commercial purposes.