Page 1 of 1

6.8.3-9 Color generated by -alpha shape differs

Posted: 2013-03-12T18:21:12-07:00
by rxaviers
We from jQueryUI use ImageMagick to generate the themeRoller custom icons and textures. Trying to upgrade IM on our server, we noticed a unwanted behavior. Perhaps we are misusing IM, and it may not be a bug. Follow the problematic use case.

We generate custom color icons as follows:
`convert icons-mask.png -background <color> -alpha shape output.png`

Picking any non-fully-saturated-color, let's say #DDAA00, we get different output using 6.8.* [1] vs. 6.6.* [2]. Point your browser to each output and you'll see 6.8.* shows a different color than the specified in <color>. (side note: actually, opening `output.png` on a graphic editor tool like GIMP, the color displays just fine. The browsers do not)

1 6.8: https://f.cloud.github.com/assets/96715 ... 5c9410.png
2 6.6: https://f.cloud.github.com/assets/96715 ... 6ff8e1.png

Are we misusing it? Any advice? Is it a regression?

More info at: https://github.com/jquery/download.jque ... issues/110

Re: 6.8.3-9 Color generated by -alpha shape differs

Posted: 2013-03-13T04:17:06-07:00
by snibgo
I've never used "-alpha shape", but some experimentation shows the behaviour has changed with the RGB/sRGB issue. See many threads related to this. In a nutshell: current IM versions convert from sRGB to RGB before calculating the grey values. Old versions (prior to about v6.7.9) didn't do this. To prevent this conversion, tell IM the image is already in RGB colourspace:

Code: Select all

convert icons-mask.png -set colorspace RGB -background <color> -alpha shape output.png

Re: 6.8.3-9 Color generated by -alpha shape differs

Posted: 2013-03-22T06:50:31-07:00
by rxaviers
Hi snibgo, thanks for the suggestion. But, it didn't work. As you can see we still have the wrong output:
https://f.cloud.github.com/assets/96715 ... 2f75ee.png
https://github.com/jquery/download.jque ... t-15297562

Re: 6.8.3-9 Color generated by -alpha shape differs

Posted: 2013-03-22T11:54:59-07:00
by snibgo
Your reference https://f.cloud.github.com/assets/96715 ... 2f75ee.png seems to be your output file. Can you supply your input file?

Re: 6.8.3-9 Color generated by -alpha shape differs

Posted: 2013-03-22T14:25:42-07:00
by snibgo
Okay, with a bit more time, I think your input image is https://f.cloud.github.com/assets/96715 ... 94572d.png Correct? This is greyscale, and almost all the pixels are either black or white. The RGB/sRGB issue will make almost no difference, because black <=> black and white <=> white across the colorspaces.

However, it's a good idea, when using "-set colorspace RGB", to follow that with "-set colorspace sRGB" before the output file. This seems to ensure the sRGB PNG chunk is written. Maybe the absence of this has been confusing some of your browsers.

Code: Select all

convert input_mask.png -background #DDAA00 -set colorspace RGB -alpha shape -set colorspace sRGB output.png
Aside from that point, all combinations of IM versions I have tried, with and without either "-set colorspace", result in the same pixel values written: every pixel is #DDAA00, but alpha varies between pixels.

Re: 6.8.3-9 Color generated by -alpha shape differs

Posted: 2013-04-08T06:38:04-07:00
by rxaviers
snibgo, it worked just fine now with the "-set colorspace sRGB" before the output file.
Thanks for your help!!