Page 1 of 1

alpha seems backwards in verbose info

Posted: 2010-04-26T10:27:45-07:00
by fmw42
IM 6.6.1-5 Q16 Mac OSX Tiger

convert rose: -alpha transparent rose_trans.png
identify -verbose rose_trans.png
...
Alpha:
min: 255 (1)
max: 255 (1)
mean: 255 (1)

standard deviation: -0 (-0)
kurtosis: 0
skewness: 0

Same for tif and gif formats

Re: alpha seems backwards in verbose info

Posted: 2010-05-07T14:43:05-07:00
by fmw42
This does not appear to be fixed in IM 6.6.1-6 Q16 Mac OSX Tiger.

Sorry if my testing is premature.

Re: alpha seems backwards in verbose info

Posted: 2010-05-07T16:39:57-07:00
by magick
We can reproduce the problem you posted and have a patch in ImageMagick 6.6.1-7 Beta available by sometime tomorrow.

Re: alpha seems backwards in verbose info

Posted: 2010-05-07T17:56:43-07:00
by fmw42
I don't know if this is related but this does not seem to work right either. Correct me if I am wrong.

1) I would expect a totally transparent image.

convert logo: -resize 50% -fill none +opaque white -transparent white logo3t.png
identify -verbose logo3t.png
...
Alpha:
min: 0 (0)
max: 255 (1)
mean: 202.121 (0.79263)


2) The following does not even turn on the alpha channel. I would have thought using -fill none would automatically do so just like -transparent .

convert logo: -resize 50% -fill none +opaque white -fill none -opaque white logo4t.png
identify -verbose logo4t.png
...
NO ALPHA CHANNEL

3) And the following is like my original issue with the values backwards:

convert logo: -channel rgba -alpha set -resize 50% -fill none +opaque white -fill none -opaque white logo5t.png
identify -verbose logo5t.png
...
Alpha:
min: 255 (1)
max: 255 (1)
mean: 255 (1)


4) And finally related to 1) above if one enables the alpha channel first, then one gets the same backwards results as 3) above

convert logo: -channel rgba -resize 50% -fill none +opaque white -transparent white logo6t.png
identify -verbose logo6t.png
...
Alpha:
min: 255 (1)
max: 255 (1)
mean: 255 (1)

Re: alpha seems backwards in verbose info

Posted: 2010-05-07T19:02:24-07:00
by magick
  • 1) I would expect a totally transparent image.

    convert logo: -resize 50% -fill none +opaque white -transparent white logo3t.png
Try this command
  • convert logo: -alpha set -fuzz 15% -channel rgba -fill none +opaque white -transparent white logo3t.png
  • 2) The following does not even turn on the alpha channel. I would have thought using -fill none would automatically do so just like -transparent .

    convert logo: -resize 50% -fill none +opaque white -fill none -opaque white logo4t.png
Use -alpha set:
  • convert logo: -alpha set -fuzz 15% -channel rgba -fill none -opaque white logo4t.png]
  • 3) And the following is like my original issue with the values backwards.
    4) And finally related to 1) above if one enables the alpha channel first, then one gets the same backwards results as 3) above
Look for a patch in ImageMagick 6.6.1-7 Beta by sometime tomorrow.

Re: alpha seems backwards in verbose info

Posted: 2010-05-07T20:02:31-07:00
by fmw42
magick wrote:2) The following does not even turn on the alpha channel. I would have thought using -fill none would automatically do so just like -transparent .

convert logo: -resize 50% -fill none +opaque white -fill none -opaque white logo4t.png

Use -alpha set:
Yes I realized that works. But why should not -fill none automatically turn on the alpha channel just like -transparent does? Does that not make sense? It seemed like a long time ago that worked. Have things changed or is this not practical?

Re: alpha seems backwards in verbose info

Posted: 2010-05-08T01:22:16-07:00
by anthony
Because you should use -transparent white, -transparent sets the -channel setting, and turns on the alpha channel, correctly.

A future fix may be to make -opaque a little smarter. For example, see the default 'sync' flag in -channel (user has not limited channel and all channels should 'syncronize'). It also could then note that transparency is needed but is present in the image, so add one.

However few operators in IM go to this level of 'smarts'. But opt to do things as simply as they can.