Page 1 of 1

Help with image tint/modulation combination

Posted: 2009-11-26T05:04:08-07:00
by nicky77
Hi, I'm trying to create a tint effect but I'm having a nightmare trying to get the desired effect. The HSB values used in Photoshop to filter the image do not have the same effect when used in ImageMagick (probably due to my own misuse of them). Anyway, i'm trying to get as close as i can to the effect below, if anyone can help that would be great. The RGB values specified are an orange which I want the image to be coloured with, but the HSB balance isn't right, as you can see below. The closest I've come is using the following code (I've tried a number of variations of this code):

Code: Select all

exec("convert $filename -colorspace Gray $new_image; convert $new_image -fill 'rgb(238, 180, 34)' -tint 100 -modulate 110,100,100 $new_image");
Original image example
Image

desired version
Image

Current result:
Image

Re: Help with image tint/modulation combination

Posted: 2009-11-26T19:12:51-07:00
by anthony
You probably need a slightly different color for the 'tint'

I am not certain what photoshop is doing (or what you are doing with photoshop) and with out that information it is hard to translate photoshop operation into ImageMagick operations.

Re: Help with image tint/modulation combination

Posted: 2009-11-27T08:38:23-07:00
by nicky77
Hi Anthony - what I've done in Photoshop is convert the image to greyscale, then apply HSL values of 36, 62, -6. I want to replicate this with ImageMagick, so I imagine it should be something like this -

Code: Select all

exec("convert $filename -colorspace Gray $new_image; convert $new_image -fill 'hsl(36, 62, -6)' -tint 100 $new_image");
However, the HSL values aren't being processed and i'm left with the image in greyscale. Is there an obvious mistake i'm making here?

Re: Help with image tint/modulation combination

Posted: 2009-11-28T13:04:57-07:00
by fmw42

Code: Select all

exec("convert $filename -colorspace Gray $new_image; convert $new_image -fill 'hsl(36, 62, -6)' -tint 100 $new_image");
you should make this one command line

exec("convert $filename -colorspace Gray -fill 'hsl(36, 62, -6)' -tint 100 $new_image");

BUT NOTE, you cannot have negative lightness (-6 is invalid)


Here is using my tintilize script. I found your basic tint color using a colorpicker to get it in hex, but you can use any IM valid color (see http://www.imagemagick.org/script/color.php and the color converter at the top should help NOTE: HSL and HSB colors have changed definition since I wrote the script. See the previous link about the current definitions as percent or raw values and their ranges.).

This is a bash unix script and you can find it at the link below:
tintilize -m "#DF9B4A" -c -25 cowboy.jpg cowboy_DF9B4A_cm25.jpg

You can use it in PHP exec. I am not expert on this but you can try
exec("/fullpathto/tintilize -m \"#DF9B4A\" -c -35 /fullpathto/cowboy.jpg /fullpathto/cowboy_DF9B4A_cm35.jpg");

Image

This works directly from IM (the +level, lowers the contrast by 10%)

cconvert cowboy.jpg -colorspace gray -fill "#DF9B4A" -tint 100 +level 10,90% cowboy_DF9B4A_t100_pl_10_90.jpg

Image

Re: Help with image tint/modulation combination

Posted: 2009-11-29T17:15:11-07:00
by anthony
nicky77 wrote:Hi Anthony - what I've done in Photoshop is convert the image to greyscale, then apply HSL values of 36, 62, -6.
As pointed out by Fred, -6 lightness is invalid. What this means in terms of what photoshop does is known. Their is a -modulate command, but it works with percentables, and does not effect tinting of grayscale image, only previously tinted images (rotation of existing colors in HSL or HSB colorspace).