Page 1 of 1

Posted: 2006-10-09T05:10:18-07:00
by glennrp
Make a large image of all of your input images and then quantize that down to 256 colors.
  • convert -append *.bmp -colors 256 map.png

    for image in *.bmp do
    base=`echo $image | sed "s/.bmp//"`
    convert $image -map map.png -colors 256 -transparent "#ff00ff" $base.png
    done
If you aren't sure 255,00,255 is in your original images, then quantize
to 255 instead of 256.

Posted: 2006-10-10T06:14:56-07:00
by glennrp
pinkfloydhomer wrote: This doesn't seem to work. First of all, I think you forgot a ";" after *.bmp. Also, the resulting .pngs are 32-bit color depth, not 8-bit. IrfanView reports that there is a palette anyway (I don't understand), but 255,0,255 is _not_ on index 0 in the palette.

Can you (or anybody) come up with another way to solve my problem?

/David

Whoops, you're right about the ";".
You could try PNG8:$base.png instead of just $base.png as the output name.
What version of ImageMagick are you using?

Posted: 2006-10-10T18:51:57-07:00
by anthony
You can make the 'map.png' file smaller by using the new -unique-colors operator. This shrinks the image down to one unique color per pixel.

Note 'magenta' (255,0,255) will probably NOT be present, after color quantization. See Quantization does NOT Preserve Colors
http://www.cit.gu.edu.au/~anthony/graph ... _not_exact

You can ensure it is added to the map by appending that color to it (after using one less
-colors argument to make room for it).
convert map.png xc:magenta +append map.png

If magenta is ment to be the transparent color you can set it as that using -transparent-color. If the images contain transparency get IM to ignore it using a -quantize transparent, before the -colors operator.
See Color Quantization and Dithering in IM Examples (see sig) for full details.

WARNING: there no current way of specifying the color index a specific color is to use in the final image, in IM.. Sorry.