(And it may be the origin of the problem of that thread.)
As example - a command that produces a 258x1 stripe with only 3 colors in it, once stored as BMP, once stored as GIF. The GIF has still 3 distinct colors, but some pixels have changed the color. Compare shows 6 shifted values with that:
Code: Select all
convert xc:grey66 xc:yellow -size 256x1 xc:darkgrey +append test.bmp
convert xc:grey66 xc:yellow -size 256x1 xc:darkgrey +append test.gif
compare -metric ae test.bmp test.gif null:
# ImageMagick pixel enumeration: 258,1,255,rgb
0,0: (168,168,168) #A8A8A8 grey66
1,0: (255,255, 0) #FFFF00 yellow
2,0: (169,169,169) #A9A9A9 DarkGray
3,0: (169,169,169) #A9A9A9 DarkGray
...(all further pixels DarkGray)
But test.gif shows this:
# ImageMagick pixel enumeration: 258,1,255,rgb
0,0: (168,168,168) #A8A8A8 grey66
1,0: (255,255, 0) #FFFF00 yellow
2,0: (168,168,168) #A8A8A8 grey66
3,0: (168,168,168) #A8A8A8 grey66
4,0: (168,168,168) #A8A8A8 grey66
5,0: (168,168,168) #A8A8A8 grey66
6,0: (168,168,168) #A8A8A8 grey66
7,0: (168,168,168) #A8A8A8 grey66
8,0: (169,169,169) #A9A9A9 DarkGray
9,0: (169,169,169) #A9A9A9 DarkGray
...
My IM version is 6.6.1-7 Q16 - on Windows XP.
The colors are sometimes reduced and/or changed like that for GIFs with a few colors - at least if there are more than 256 pixels (with less than 256 pixels there is of course no need for color reductions). You will get different 'error counts' with different color values. The problem seems to be in the color reduction part - because the changes also show when you add "-colors 256" to the command and store as e.g. PNG.
Workarounds:
One can retain the correct values (only up to 256 colors of course) if one writes the files in two steps. First output as PNG8, then a simple "convert test.png test.gif" will do it.
Or: Applying a manual color reduction before writing as GIF seems to be ok - with dithering disabled. So, the command from above doesn't change the colors if done like that:
convert xc:grey66 xc:yellow -size 256x1 xc:darkgrey +append +dither -colors 256 test.gif