detecting transparency of PNG file with matte() now fails
Posted: 2012-12-13T07:36:08-07:00
[cross post from Magick++ forum as I received no responses. Maybe some kind soul here will know what is going on.]
Hello all,
I have a project that is used to generate thumbnails and previews of various image types using the IM library. I had been using the ImageMagick library version 6.5.9. With that version, I could detect the presence of a transparency layer in a certain PNG file I have using the Magick++ Image class method matte(). It would return true for this file.
I needed to perform this detection in order to know when to use the "-flatten" feature to compose a thumbnail of the image on a white background. All was fine.
When I updated the underlying ImageMagick library to 6.7.9 the detection now fails. The matte() method used on the Image object after loading this source image file now returns false for the same file. The type() method returns MagickCore::TrueColorType. But when I use the "identify -verbose" command line tool from IM 6.7.6 I get the following output:
Is the change in the response from the matte() function a likely bug? Is there some other way to find out if there is a transparency layer?
Thanks.
Regards,
-Rajpaul
Hello all,
I have a project that is used to generate thumbnails and previews of various image types using the IM library. I had been using the ImageMagick library version 6.5.9. With that version, I could detect the presence of a transparency layer in a certain PNG file I have using the Magick++ Image class method matte(). It would return true for this file.
I needed to perform this detection in order to know when to use the "-flatten" feature to compose a thumbnail of the image on a white background. All was fine.
When I updated the underlying ImageMagick library to 6.7.9 the detection now fails. The matte() method used on the Image object after loading this source image file now returns false for the same file. The type() method returns MagickCore::TrueColorType. But when I use the "identify -verbose" command line tool from IM 6.7.6 I get the following output:
Code: Select all
Format: PNG (Portable Network Graphics)
Class: DirectClass
Geometry: 792x504+0+0
Resolution: 28.35x28.35
Print size: 27.9365x17.7778
Units: PixelsPerCentimeter
Type: TrueColorMatte
Endianess: Undefined
Colorspace: sRGB
Depth: 8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 8-bit
alpha: 8-bit
Channel statistics:
Red:
min: 0 (0)
max: 255 (1)
mean: 93.8249 (0.367941)
standard deviation: 104.48 (0.409726)
kurtosis: -1.25472
skewness: 0.703069
Green:
min: 0 (0)
max: 255 (1)
mean: 96.0525 (0.376677)
standard deviation: 104.367 (0.409282)
kurtosis: -1.30609
skewness: 0.656662
Blue:
min: 0 (0)
max: 255 (1)
mean: 103.821 (0.407141)
standard deviation: 104.817 (0.411046)
kurtosis: -1.47573
skewness: 0.491882
Alpha:
min: 0 (0)
max: 255 (1)
mean: 105.996 (0.415672)
standard deviation: 119.074 (0.466956)
kurtosis: -1.79443
skewness: -0.371703
Image statistics:
Overall:
min: 0 (0)
max: 255 (1)
mean: 110.675 (0.434022)
standard deviation: 108.367 (0.424969)
kurtosis: -1.57012
skewness: 0.375226
Alpha: srgba(255,255,255,0) #FFFFFF00
Rendering intent: Perceptual
Gamma: 0.45455
Chromaticity:
red primary: (0.63999,0.33001)
green primary: (0.3,0.6)
blue primary: (0.15,0.05999)
white point: (0.31269,0.32899)
Interlace: None
Background color: white
Border color: srgba(223,223,223,1)
Matte color: grey74
Transparent color: none
Compose: Over
Page geometry: 792x504+0+0
Dispose: Undefined
Iterations: 0
Compression: Zip
Orientation: Undefined
...
Thanks.
Regards,
-Rajpaul