Hi hecatonchire
yes, that was the test image to be processed by my code.
Try to convert eart.tga, get the result,
convert the same file with your program,
compare the results
that is what i get after dithering but before color reduction to 2 colors per 8X1 pixels.
that the point, how to choice those 2 **** colors.
Great!! Can you post your algorithm ?
Where am I wrong ?
Sorry, misunderstood. You get this result witout imposing the 2 color constrain...
Witout screen 2 limitations, I get the same.
So, no point for looking into your ccode.
The problems comes passing to screen 2.
Adding the 2 color limitation, I get lots of horizontal stripes, where Jannone's
conversion is far better and looks almost identical to the ditered version
without color limitations.
I'm trying to do some reverese engineering from it's program, without success.
I think that you should forget how many times a color is used and select the two colors that are most far apart in 3D color space. After that you should implement rasterization. I think this is the way that BMP2MSX is using. Maybe you should peek BMP2MSX sources.
Good suggestion, I'll work on this
Thanks
I've opened Jannone's source codes for the Foyd algorithm
(he kindly distributed them with the release on MRC)
Does anyone know PHP ?
the part that I do not uderstand and that should select the 2
colors per 8 point lines (before actually implementing Floyd)
should be this:
[...] $g8 = imagecreatetruecolor(8, 1); for ($i = 0; $i < 8; $i++) { $c = $dither_line1[$x + $i + 1]; pixel_clamp($c); imagesetpixel($g8, $i, 0, ($c[0] << 16) | ($c[1] << 8) | $c[2]); } imagetruecolortopalette($g8, true, 8); $c1 = @imagecolorsforindex($g8, 0); $c2 = @imagecolorsforindex($g8, 1); imagedestroy($g8); $c1 = imagecolorclosest($msx, $c1['red'], $c1['green'], $c1['blue']); $c2 = imagecolorclosest($msx, $c2['red'], $c2['green'], $c2['blue']); /* get the RGB color of bits 0 and 1 */ $bit0 = &$palette[$c1]; $bit1 = &$palette[$c2]; /* let's generate the bitmask using those colors */ [...]
anyone able to explain what does it do ?
IMHO the trick comes from >> imagetruecolortopalette($g8, true, 8);
which generates 8 colors from a 8x1 group of pixels (even if this group has less than 8 colors),
then the first Two generated colors are kept to generate the bitmask in screen 2.
Why these the 2 first generated colors is good enough, is quite misterious.
this is the link for getting the code...
http://www.msx.org/MSX-Screen-Conversor-0.8-Standalone-versions.newspost4238.html
but I cannot find what the imagetruecolortopalette function does...