Convert true color image to -- a few colors --

Blitz3D Forums/Blitz3D Programming/Convert true color image to -- a few colors --

bytecode77(Posted 2007) [#1]
hi!


this is what i got for x-mas.

i thought about converting a true color image with that resolution into the colors i have here on that pic.

so e.g if you have a 24 bit RGB color value and you have to convert this into the colors you see on the photo...
how am i going to do that? anyone any idea???

thx if you help me! :)


jfk EO-11110(Posted 2007) [#2]
Do I get this right, you want to use the colored plastic thingies to make a picture? They are pretty big, so I think dithering is no option. I would reduce the number of colors on the 24 Bit image until it fits the number of colors you got there in the pot. Then see which colors fit best to the ones on the image.

Reducing colors may be done with a graphics app. You can also do it in Blitz code, eg:

rgb=readpixelfast(x,y) and $FFFFFF
writepixelfast x,y, rgb and %111100001111000011110000

this will erase the lower significant 4 bits of each channel, resulting in less color tones.


bytecode77(Posted 2007) [#3]
hm. that lowers the color palette, but it still doesnt fit my colors...


_33(Posted 2007) [#4]
You have to define the RGB values of your colors.

Suggestions:
- Make a table of your color palette
- Make a routine that find the closest color from an RGB and returns the color in your color palette
- Try the 2 above with a routine that scans X and Y and replaces all colors with the resulting color from the "closest palette color" routine


bytecode77(Posted 2007) [#5]
hm. for example a bright blue color will result in white instead of blue. since i tried to calculate the new rgb values by using a little random value it works!!

thanks guys, you didnt really post a solution but the tricks you showed me gave me the ideas!