Selective color conversion

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

Post by anthony »

LUT works well for individual color channels and grey scale images, but is more difficult for full color images.

My suggestion is that as you specifically want the near red and near yellow colors is to search for those colors and use them to generate a mask for the original image. The mask can then be used to change all the other colors.

An example of this was developed for explaining 'Fuzz Factors' for nearby color selections..
See the second example in... Fuzz Factor - Matching Similar Colors
http://www.cit.gu.edu.au/~anthony/graph ... tize/#fuzz

Hmmm using the colorwheel image in the examples above....

Code: Select all

   convert colorwheel.jpg \
          \( +clone -fuzz 20% -transparent red -transparent yellow \
          -fill pink -colorize 100% \) -composite   red-yellow.png
Basically I made a copy, converts reds and yellow to transparency, then all other colors to pink. I then composited the new image over the original image so only the original red and yellow colors show through.. Think of it as creating a 'pink overlay mask'.

In fact this method is SO GOOD, I am replacing the original one used in IM examples, as it is simplier to understand!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply