modulate bug

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
gsso

modulate bug

Post by gsso »

So I'v been trying to change only one of the three (brightness, saturation, hue ) just as its written here:http://www.imagemagick.org/script/comma ... p#modulate

but it seems that when you try to change for example Hue only you get saturation and brightness changed as well:

Image
the above sample checked in photoshop (HSB): hue-13 saturation-16% brightness-93%

system("convert sample.jpg -modulate 100,270,100 ./final/sample2.jpg");

Image
and the result is: hue-15 saturation-35% brightness-100%

and by the way, if I change saturation with a multiplier of 270% of the oryginal (HSB saturation 16%), isnt it suppose to end up being about 43%?

tested on windows ImageMagick 6.4.5
and linux ImageMagick 6.4.9-4
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: modulate bug

Post by fmw42 »

You have the components in the wrong order within -modulate. It is:

-modulate brightness[,saturation,hue]

So your value of -modulate 100,270,100

IS actually changing the saturation (only) and not the hue

Also the default was change at some point not too long ago (IM 6.4.0-10) to colorspace HSL rather than HSB, but you can set it to either now. see http://www.imagemagick.org/Usage/color/#modulate
gsso

Re: modulate bug

Post by gsso »

Ok, I was thinking about Saturation and wrote Hue, my bad.

But still, it doesnt change the fact, that when you change Saturation only it also changes the Hue and Brightness

check the examples I gave.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: modulate bug

Post by fmw42 »

OK, testing (but I happen to be in HDRI right now and don't know if this is an issue):

#measure your rgb colors
convert colorsample.jpg -scale 1x1! txt:-
# ImageMagick pixel enumeration: 1,1,255,rgb
0,0: (238,208,200) #EED0C8 rgb(238,208,200)

#create new test swatch as png (to avoid jpg compression color changes)
convert -size 100x100 xc:"rgb(238,208,200)" colorswatch.png
Image

#measure the HSL colors of colorswatch.png
convert colorswatch.png -scale 1x1! -colorspace HSL txt:-
# ImageMagick pixel enumeration: 1,1,65535,hsl
0,0: ( 2299,34588,56283) #08FB871CDBDB hsl(3.50877%,52.7778%,85.8824%)

#modulate colorswatch
convert colorswatch.png -modulate 100,270,100 colorswatch_mod_100_270_100.png
Image

#measure the HSL colors of modulated image
convert colorswatch_mod_100_270_100.png -scale 1x1! -colorspace HSL txt:-
# ImageMagick pixel enumeration: 1,1,65535,hsl
0,0: ( 2702,65535,54317) #0A8EFFFFD42D hsl(4.12358%,100%,82.8824%)

So either the hue and lightness are getting changed slightly (hue from 3.5 to 4.1 and lightness from 85.8 to 82.8 ), or it is precision, or it is my HDRI, or hsl color measurement is off some?

By the way, you can only increase the saturation so much, so once it reaches 100% that is all you can do. So you started with 52.8% saturation. Anything more than about 200 in modulation (i.e. 2x) will make it fully saturated or at 100%, which is what you have achieved. The hue and lightness have not changed that much. But indeed they are somewhat different.

NOTE: I did everything in HSL as -modulate uses HSL as default rather than HSB.
Post Reply