harmonize the color palette of several pictures

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
bongo
Posts: 2
Joined: 2011-03-22T08:34:33-07:00
Authentication code: 8675308

harmonize the color palette of several pictures

Post 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!
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: harmonize the color palette of several pictures

Post 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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply