Page 1 of 1

Applying different Colors to an Image

Posted: 2016-06-09T08:29:06-07:00
by Licy
Hello All,

I am using Imagemagick version 6.9.3-6 to apply different colors on one image. For this, first I created a Split image with the colors that I needed using this command - convert -size 50x367 gradient:Red-orange -size 50x367 gradient:orange-pink -append split.png (All images can be found at this link - https://www.dropbox.com/sh/l5r50t8yy1r0 ... usDOa?dl=0). I then used split.png on 1.png to get 1_colored.png using the following command : convert 1.png split.png -clut 1_colored.png.

1_colored.png is not exactly what was desired, but somewhat close to. When I use the same script for images like 2.png or similar images, i get a completely undesirable output. Please see 2_colored.png. I was expecting output somewhat close to 1_colored.png

How can I modify the above script to get uniform color highlights that you can see in example1.jpg and example2.jpg. Also, what should I do to get an output like bottomcolor1.jpg where only bottom part of the image has a different color.

Thanks,
Licy

Re: Applying different Colors to an Image

Posted: 2016-06-14T11:48:13-07:00
by Licy
Guys,

I haven't received a reply to my earlier question. So, please let me know if you need any other details?

Thanks

Re: Applying different Colors to an Image

Posted: 2016-06-14T12:33:02-07:00
by snibgo
"-clut" changes colors. When the input is greyscale (which the hair photos are, more or less), it will change black into red and white into orange.

Your image 2.png has no white. The lightest part of the hair is about 30%, and there isn't much of that. You can stretch the input before applying the clut:

Code: Select all

convert 2.png -background Black -level 0,30% split.png -clut 2a.png
To apply an image across part of the image, create a same-size mask the same size, white where you want the effect, black where you dont, 75% gray where you want 75% of the effect, and so on. Then:

Code: Select all

convert original.png effected.png mask.png -composite out.png