IM 6.5.8-10 Q16 Mac OSX Tiger
Could some one please clarify an issue I am having with -alpha opaque and -alpha set. I am using this image: http://timotheegroleau.com/tmp/external-crushed.png
The docs say
"Set ...... Turns 'On' the alpha/matte channel and if it was previously turned off resets the channel to opaque. If the image already had the alpha channel turned on, it will have no effect. This is the same as the older -matte operator.
Opaque ...... Turns 'On' the alpha/matte channel and forces it to be fully opaque."
-----> Which leads me to believe that I should find a totally opaque alpha channel listed in the verbose stats. But I don't find any alpha enabled at all. IS THIS A BUG? Or am I misunderstanding the documentation?
convert external-crushed.png -alpha opaque external-crushed_aop.png
identify -verbose external-crushed_aop.png
The above lists no alpha channel.
Should not -alpha opaque and -alpha set actually enable the alpha channel as opaque rather than having no alpha channel? So either these functions are not working per the docs or the docs need to be modified to say that the alpha channel is then disabled (turned off)
Please correct/illuminate me on this issue?
Fred
clarification on -alpha opaque
Re: clarification on -alpha opaque
We can reproduce the problem you posted and have patch in ImageMagick-6.5.9-0. Thanks for the problem report.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: clarification on -alpha opaque
Their should not have been any bug.
For an image with a existing alpha channel (and possibility some transparency) -alpha set does NOTHING!
For an image without an alpha channel (or just turned off) it makes sure a opaque alpha channel exists.
In other words this operator should never change the appearance of the current image, only ensure it has
an alpha channel.
I checked IM examples ASSERTIONS on this and it does appear to be working correctly.
For an image with a existing alpha channel (and possibility some transparency) -alpha set does NOTHING!
For an image without an alpha channel (or just turned off) it makes sure a opaque alpha channel exists.
In other words this operator should never change the appearance of the current image, only ensure it has
an alpha channel.
I checked IM examples ASSERTIONS on this and it does appear to be working correctly.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: clarification on -alpha opaque
This image has no alpha channel to start.
But the issue seems to have been fixed already for this image.
But it does not work for gif as follows:
convert rose: rose.gif
convert rose.gif -alpha on rose_aon.gif
identify -verbose rose_aon.gif
Image: rose_aon.gif
Format: GIF (CompuServe graphics interchange format)
Class: PseudoClass
Geometry: 70x46+0+0
Resolution: 72x72
Print size: 0.972222x0.638889
Units: Undefined
Type: Palette
Endianess: Undefined
Colorspace: RGB
Depth: 8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 8-bit
Channel statistics:
Red:
min: 42 (0.164706)
max: 255 (1)
mean: 145.186 (0.569358)
standard deviation: 69.2653 (0.271629)
kurtosis: -1.38935
skewness: 0.139583
Green:
min: 26 (0.101961)
max: 254 (0.996078)
mean: 88.7807 (0.34816)
standard deviation: 52.4741 (0.205781)
kurtosis: 2.62012
skewness: 1.81604
Blue:
min: 28 (0.109804)
max: 255 (1)
mean: 80.0009 (0.313729)
standard deviation: 55.0807 (0.216003)
kurtosis: 2.95186
skewness: 1.96962
Image statistics:
Overall:
min: 26 (0.101961)
max: 255 (1)
mean: 78.492 (0.307812)
standard deviation: 72.9766 (0.286183)
kurtosis: 0.0606039
skewness: 0.97181
Histogram:
27: ( 42, 41, 38) #2A2926 rgb(42,41,38)
2: ( 43, 47, 30) #2B2F1E rgb(43,47,30)
54: ( 44, 43, 43) #2C2B2B rgb(44,43,43)
35: ( 44, 50, 44) #2C322C rgb(44,50,44)
25: ( 44, 54, 41) #2C3629 rgb(44,54,41)
21: ( 45, 46, 49) #2D2E31 rgb(45,46,49)
3: ( 47, 47, 48) #2F2F30 rgb(47,47,48)
32: ( 50, 44, 43) #322C2B rgb(50,44,43)
19: ( 51, 50, 44) #33322C rgb(51,50,44)
There is no sign of an opaque alpha channel in the gif above.
But it does work to get an opaque alpha channel for png:
convert rose: rose.png
convert rose.png -alpha on rose_aon.png
identify -verbose rose_aon.png
Image: rose_aon.png
Format: PNG (Portable Network Graphics)
Class: DirectClass
Geometry: 70x46+0+0
Resolution: 72x72
Print size: 0.972222x0.638889
Units: Undefined
Type: TrueColorMatte
Endianess: Undefined
Colorspace: RGB
Depth: 8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 8-bit
alpha: 1-bit
Channel statistics:
Red:
min: 35 (0.137255)
max: 255 (1)
mean: 145.712 (0.57142)
standard deviation: 69.2953 (0.271746)
kurtosis: -1.385
skewness: 0.14637
Green:
min: 22 (0.0862745)
max: 255 (1)
mean: 89.2602 (0.35004)
standard deviation: 52.4698 (0.205764)
kurtosis: 2.63898
skewness: 1.81893
Blue:
min: 24 (0.0941176)
max: 255 (1)
mean: 80.4683 (0.315562)
standard deviation: 55.1114 (0.216123)
kurtosis: 3.01818
skewness: 1.9795
Alpha:
min: 255 (1)
max: 255 (1)
mean: 255 (1)
standard deviation: -0 (-0)
kurtosis: 0
skewness: 0
Image statistics:
But the issue seems to have been fixed already for this image.
But it does not work for gif as follows:
convert rose: rose.gif
convert rose.gif -alpha on rose_aon.gif
identify -verbose rose_aon.gif
Image: rose_aon.gif
Format: GIF (CompuServe graphics interchange format)
Class: PseudoClass
Geometry: 70x46+0+0
Resolution: 72x72
Print size: 0.972222x0.638889
Units: Undefined
Type: Palette
Endianess: Undefined
Colorspace: RGB
Depth: 8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 8-bit
Channel statistics:
Red:
min: 42 (0.164706)
max: 255 (1)
mean: 145.186 (0.569358)
standard deviation: 69.2653 (0.271629)
kurtosis: -1.38935
skewness: 0.139583
Green:
min: 26 (0.101961)
max: 254 (0.996078)
mean: 88.7807 (0.34816)
standard deviation: 52.4741 (0.205781)
kurtosis: 2.62012
skewness: 1.81604
Blue:
min: 28 (0.109804)
max: 255 (1)
mean: 80.0009 (0.313729)
standard deviation: 55.0807 (0.216003)
kurtosis: 2.95186
skewness: 1.96962
Image statistics:
Overall:
min: 26 (0.101961)
max: 255 (1)
mean: 78.492 (0.307812)
standard deviation: 72.9766 (0.286183)
kurtosis: 0.0606039
skewness: 0.97181
Histogram:
27: ( 42, 41, 38) #2A2926 rgb(42,41,38)
2: ( 43, 47, 30) #2B2F1E rgb(43,47,30)
54: ( 44, 43, 43) #2C2B2B rgb(44,43,43)
35: ( 44, 50, 44) #2C322C rgb(44,50,44)
25: ( 44, 54, 41) #2C3629 rgb(44,54,41)
21: ( 45, 46, 49) #2D2E31 rgb(45,46,49)
3: ( 47, 47, 48) #2F2F30 rgb(47,47,48)
32: ( 50, 44, 43) #322C2B rgb(50,44,43)
19: ( 51, 50, 44) #33322C rgb(51,50,44)
There is no sign of an opaque alpha channel in the gif above.
But it does work to get an opaque alpha channel for png:
convert rose: rose.png
convert rose.png -alpha on rose_aon.png
identify -verbose rose_aon.png
Image: rose_aon.png
Format: PNG (Portable Network Graphics)
Class: DirectClass
Geometry: 70x46+0+0
Resolution: 72x72
Print size: 0.972222x0.638889
Units: Undefined
Type: TrueColorMatte
Endianess: Undefined
Colorspace: RGB
Depth: 8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 8-bit
alpha: 1-bit
Channel statistics:
Red:
min: 35 (0.137255)
max: 255 (1)
mean: 145.712 (0.57142)
standard deviation: 69.2953 (0.271746)
kurtosis: -1.385
skewness: 0.14637
Green:
min: 22 (0.0862745)
max: 255 (1)
mean: 89.2602 (0.35004)
standard deviation: 52.4698 (0.205764)
kurtosis: 2.63898
skewness: 1.81893
Blue:
min: 24 (0.0941176)
max: 255 (1)
mean: 80.4683 (0.315562)
standard deviation: 55.1114 (0.216123)
kurtosis: 3.01818
skewness: 1.9795
Alpha:
min: 255 (1)
max: 255 (1)
mean: 255 (1)
standard deviation: -0 (-0)
kurtosis: 0
skewness: 0
Image statistics:
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: clarification on -alpha opaque
-alpha is not involved for images stored to file, only images in memory. Nothing really to do with file formats!
The GIF in the above has no transparency. In fact GIF images have no alpha channel, only a optional transparent color in the color table. That is it sets some existing color in the coor table to means 'full-transparency'.
For example
Clearly shows that alpha is a single color in the Colormap. It isn't stored as a channel.
PNG can have a color channel.
PNG8 palete sub-format, can declare a specific range of colors to be semi-transparent, though IM only can create a single 'fully-transparent' color in the color table just as it does for GIF.
The GIF in the above has no transparency. In fact GIF images have no alpha channel, only a optional transparent color in the color table. That is it sets some existing color in the coor table to means 'full-transparency'.
For example
Code: Select all
identify -verbose http://www.imagemagick.org/Usage/images/hand_point.gif
Code: Select all
Image: /tmp/magick-XXzLUqcj
Base filename: hand_point.gif
Format: GIF (CompuServe graphics interchange format)
Class: PseudoClass
Geometry: 32x32+0+0
...
Type: PaletteMatte
...
Alpha: rgba(204,204,204,0) #CCCCCC00
Histogram:
172: ( 0, 0, 0,255) #000000 black
4: (190,190,190,255) #BEBEBE grey
583: (204,204,204, 0) #CCCCCC00 rgba(204,204,204,0)
28: (205,133, 63,255) #CD853F peru
218: (245,222,179,255) #F5DEB3 wheat
19: (255,250,205,255) #FFFACD LemonChiffon
Colormap: 8
0: ( 0, 0, 0,255) #000000 black
1: (205,133, 63,255) #CD853F peru
2: (190,190,190,255) #BEBEBE grey
3: (245,222,179,255) #F5DEB3 wheat
4: (255,250,205,255) #FFFACD LemonChiffon
5: (204,204,204, 0) #CCCCCC00 rgba(204,204,204,0)
6: ( 0, 0, 0,255) #000000 black
7: ( 0, 0, 0,255) #000000 black
...
Transparent color: rgba(204,204,204,0)
...
Version: ImageMagick 6.6.1-1 2010-04-06 Q16 http://www.imagemagick.org
PNG can have a color channel.
PNG8 palete sub-format, can declare a specific range of colors to be semi-transparent, though IM only can create a single 'fully-transparent' color in the color table just as it does for GIF.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/