Converting a transparent TIFF to PNG loses pixels
Posted: 2014-06-04T10:50:28-07:00
I'm using ImageMagick 6.8.9-2 (which exhibits the same behaviour as 6.7.7-7, the oldest version I tested), built from source on Linux. The problem was reported in a system that uses 6.7.1 on Windows (installed using the official installer, i.e., it's probably nothing to do with how I'm building from source).
I have a problematic TIFF; I'm not sure what's different about it, but I include the output of identify -verbose below (sans IPTC etc). It's a copyrighted image, so if the clues aren't in the output below I'll see if I can get a release for testing.
The image is of a statue on a plain background. I'm using the display command from IM 6.2.8 to view it (the version installed with the OS; my builds of IM don't have X11 support).
If I convert the image to JPEG, the JPEG output looks fine:
If I convert the image to PNG, the statue is missing, and I see a checkerboard pattern where it should be (i.e. those pixels are transparent). (Strangely, the miniature guide image that the display command pops up looks correct, but the full size image does not.)
However it doesn't seem to be about PNG; if I scale the image before converting to JPEG, the statue is also lost:
I can work around it for the time being by saving to JPEG and then scaling; if anyone has a better workaround, I'm all ears - even if we can get a fix into a future ImageMagick for this, it'd be convenient to have a solution for our older deployed versions.
I have a problematic TIFF; I'm not sure what's different about it, but I include the output of identify -verbose below (sans IPTC etc). It's a copyrighted image, so if the clues aren't in the output below I'll see if I can get a release for testing.
The image is of a statue on a plain background. I'm using the display command from IM 6.2.8 to view it (the version installed with the OS; my builds of IM don't have X11 support).
If I convert the image to JPEG, the JPEG output looks fine:
Code: Select all
convert test.tif test.jpg
However it doesn't seem to be about PNG; if I scale the image before converting to JPEG, the statue is also lost:
Code: Select all
convert test.tif -geometry 300x300 test.jpg # statue is now a black silhouette
Code: Select all
Image: test.tif
Format: TIFF (Tagged Image File Format)
Class: DirectClass
Geometry: 5455x7800
Type: TrueColorMatte
Endianess: MSB
Colorspace: RGB
Channel depth:
Red: 8-bits
Green: 8-bits
Blue: 8-bits
Alpha: 8-bits
Channel statistics:
Red:
Min: 0 (0)
Max: 255 (1)
Mean: 107.753 (0.422563)
Standard deviation: 48.7701 (0.191255)
Green:
Min: 0 (0)
Max: 255 (1)
Mean: 107.246 (0.420573)
Standard deviation: 49.1459 (0.192729)
Blue:
Min: 0 (0)
Max: 255 (1)
Mean: 110.313 (0.4326)
Standard deviation: 48.5394 (0.190351)
Alpha:
Min: 255 (1)
Max: 0 (0)
Mean: 146.287 (0.573673)
Standard deviation: 125.801 (0.493338)
Alpha: (205,208,213,255) #CDD0D5FF
Colors: 173943
Rendering intent: Undefined
Resolution: 300x300
Units: PixelsPerInch
Filesize: 1.6e+02mb
Interlace: None
Background color: white
Border color: #DFDFDF00
Matte color: grey74
Page geometry: 5455x7800+0+0
Dispose: Undefined
Iterations: 0
Compression: None
Orientation: TopLeft
...
Software: Adobe Photoshop CS4 Windows
...