Page 1 of 1

Reduce an image to 15 colors from a 159 color palette.

Posted: 2013-07-05T14:17:30-07:00
by Metroids
I want something like this:

Code: Select all

convert input.png -dither Riemersma -remap palette.png -colors 15 output.png
(but I don't think that's a valid use of the library, pretty sure it's ignoring the colors param)

Input is an arbitrary image. Palette looks like this: http://topolla.net/images/palette.png

A two step process like this works, but I don't think it chooses the best image.

Code: Select all

convert input.png -dither Riemersma -remap palette.png ouput.png
convert ouput.png -dither Riemersma -colors 15 ouput_final.png

Re: Reduce an image to 15 colors from a 159 color palette.

Posted: 2013-07-05T14:41:25-07:00
by snibgo
"-colors 15" chooses, from all possible colors, the 15 colors that best fit the image.

If you want to restrict the possible colors to those in palette.png, you could:

1. Remap to palette.png.

2. From the result, find the 15 most common colors.

3. Make a palette map of those 15 colors.

4. Remap input.png to the map from (3).

Re: Reduce an image to 15 colors from a 159 color palette.

Posted: 2013-07-09T12:38:40-07:00
by Metroids
Thanks, I've gotten pretty good results from that process.