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?".
Hi, as part of another project I ask if is possible the following.
In this image below you see a green arc. Well, the 2 black rectangles and the small red rectangle have a red line across them. The lines and the arc have the same type of green.
I ask if is possible to replace only the color of the arc from green to purple and the green lines within the 3 rectangles remain green like this:
Is this an actual image you are going to be using? Sometimes users post an image and the forum users reply and in fact it is nothing like the actual image the OP is going to use. This means that time is wasted with incorrect answers.
Are the other images you are going to use similar?
If this is the actual image and all the others are the same you could crop the top half, modify the colour then paste it back together again; but as you can guess this will not be the same for an image where the green arc was at the bottom.
The green areas are not only on the top. The green lines I want to isolate have 1 pixel heigth. If there is way to identify these lines to change the colors only tho the lines to diferentiate from the rest of green areas, or replace colors of green areas except the 1 pixel lines.
Your second image has a PNG extension but is really a JPEG. This is lossy, which means some of your "green" pixels are really a different colour. Please don't post PNG images that are really JPEG. It confuses everyone.
What do you want to do about the antialiasing around the green arcs?
A way to approach the problem is:
1. Convert green pixels to white, and everything else to black.
2. From that, turn black all white pixels that have a black pixel above and below.
3. The result is now white where we want to replace green with purple, and black where we want no change.
4. So, we make an image with this change (or simply make a purple image) and do a masked composite over the input.
I've been able to do the first 3 steps snibgo suggested. Now, I dont know how to do the last step. A masked composite over the input.
A way to approach the problem is:
1. Convert green pixels to white, and everything else to black.
2. From that, turn black all white pixels that have a black pixel above and below.
3. The result is now white where we want to replace green with purple, and black where we want no change.
4. So, we make an image with this change (or simply make a purple image) and do a masked composite over the input.