6.8.3-9 Color generated by -alpha shape differs

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
rxaviers
Posts: 3
Joined: 2013-03-12T12:42:04-07:00
Authentication code: 6789

6.8.3-9 Color generated by -alpha shape differs

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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
snibgo's IM pages: im.snibgo.com
rxaviers
Posts: 3
Joined: 2013-03-12T12:42:04-07:00
Authentication code: 6789

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

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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?
snibgo's IM pages: im.snibgo.com
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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.
snibgo's IM pages: im.snibgo.com
rxaviers
Posts: 3
Joined: 2013-03-12T12:42:04-07:00
Authentication code: 6789

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

Post by rxaviers »

snibgo, it worked just fine now with the "-set colorspace sRGB" before the output file.
Thanks for your help!!
Post Reply