Page 1 of 1

possible bug -contrast-stretch IM 6.7.8.7 Q16

Posted: 2012-08-01T10:13:02-07:00
by fmw42
IM 6.7.8.7 Q16 Mac OSX Snow Leopard

-contrast-stretch is not behaving as it used to before IM 6.7.7.8. It seems to be converting the image to linear space? Is this the desired behavior? To fix the problem I have to add -set colorspace RGB before -contrast-stretch.

Input:
Image


IM 6.7.8.7
convert monet3.jpg -contrast-stretch 1%,1% monet3_cs_im.jpg
Image

IM 6.7.4.10
im6 convert monet3.jpg -contrast-stretch 1%,1% monet3_cs_im6.jpg
Image

IM 6.7.6.10
imo convert monet3.jpg -contrast-stretch 1%,1% monet3_cs_imo.jpg
Image

Re: possible bug -contrast-stretch IM 6.7.8.7 Q16

Posted: 2012-08-01T16:04:42-07:00
by magick
Contrast is behaving properly but differently from previous versions. You can recover the older behavior with
  • convert monet3.jpg -colorspace RGB -contrast-stretch 1%,1% -colorspace sRGB monet3_cs_im.jpg
Contrast stretch analyzes the grayscale histogram of the image. Your image is in the sRGB colorspace, so it first removes the gamma function which as expected returns a different grayscale histogram than previous releases. Previous releases of IM assumed linear RGB so decompanding was not necessary.

Re: possible bug -contrast-stretch IM 6.7.8.7 Q16

Posted: 2012-08-01T16:21:14-07:00
by fmw42
magick wrote:Contrast is behaving properly but differently from previous versions. You can recover the older behavior with
  • convert monet3.jpg -colorspace RGB -contrast-stretch 1%,1% -colorspace sRGB monet3_cs_im.jpg
Contrast stretch analyzes the grayscale histogram of the image. Your image is in the sRGB colorspace, so it first removes the gamma function which as expected returns a different grayscale histogram than previous releases. Previous releases of IM assumed linear RGB so decompanding was not necessary.
OK. Thanks.