alpha seems backwards in verbose info

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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

alpha seems backwards in verbose info

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: alpha seems backwards in verbose info

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: alpha seems backwards in verbose info

Post by magick »

We can reproduce the problem you posted and have a patch in ImageMagick 6.6.1-7 Beta available by sometime tomorrow.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: alpha seems backwards in verbose info

Post 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)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: alpha seems backwards in verbose info

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: alpha seems backwards in verbose info

Post 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?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: alpha seems backwards in verbose info

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply