Replacing a set of colors with another set of colors
Posted: 2013-05-29T14:53:58-07:00
Hi all - sorry if this has been asked before, but I couldn't find an answer using search.
I'm using Imagemagick on Linux (Xubuntu). I have a folder of pngs (named with numbers, e.g., 3096.png) which are just colored blobs on a transparent background. The blobs are different colors, with several blobs of each color. Each image has anywhere from 1 to 10 colors.
I'm trying to do the following:
If the image has blobs of only 1 color, convert to red (#FF0000)
If the image has blobs of two colors, convert blobs of the first to red and blobs of the second to green (#00FF00)
If the image has blobs of three colors, convert blobs of the first to red, the second to green, and the third to blue (#0000FF)
... and so on. I don't care what the existing colors are - I just want them to be replaced with colors from my specified set of colors so that I can work on them for a project.
Is this possible? I'd really appreciate any help.
Thanks!
I'm using Imagemagick on Linux (Xubuntu). I have a folder of pngs (named with numbers, e.g., 3096.png) which are just colored blobs on a transparent background. The blobs are different colors, with several blobs of each color. Each image has anywhere from 1 to 10 colors.
I'm trying to do the following:
If the image has blobs of only 1 color, convert to red (#FF0000)
If the image has blobs of two colors, convert blobs of the first to red and blobs of the second to green (#00FF00)
If the image has blobs of three colors, convert blobs of the first to red, the second to green, and the third to blue (#0000FF)
... and so on. I don't care what the existing colors are - I just want them to be replaced with colors from my specified set of colors so that I can work on them for a project.
Is this possible? I'd really appreciate any help.
Thanks!