Page 1 of 1

harmonize the color palette of several pictures

Posted: 2011-03-22T23:23:28-07:00
by bongo
i have several pictures with 8 bit color depth, i.e. with a palette of 256 colors, that i would like to merge to a single picture.
as each of the pictures has another color palette, and the final picture does not have to increase the total color depth, i would like to harmonize the color palette of all pictures before merging.
i.e.
1. extract the color palette from all pictures, with a weight that tells me how often a color is used
2. generate a common color palette, more or less covering all relevant colors of all pictures
3. apply this palette to all pictures
is there a way to do this in an automated way using imagemagick?
or is there another way to do this?
thank you very much!

Re: harmonize the color palette of several pictures

Posted: 2011-03-22T23:39:22-07:00
by anthony
Any particular reason you want to do it first and not afterward???

Imagemagick does this automatically if needed. Just merge your images together then either color reduce to 256 colors, or save to GIF file format

For separate images you can use +map which will generate a common colormap of 256 colors

See IM Examples
http://www.imagemagick.org/Usage/anim_opt/#colortables

Yes it is for GIF, but that is a very common colormap problem.

Another similar but more detailed set of examples, for video to GIF animation is in
http://www.imagemagick.org/Usage/video/#gif