[CLOSED] Scaling TIFF loses pixels

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
sacha
Posts: 17
Joined: 2012-04-12T14:37:19-07:00
Authentication code: 8675308

[CLOSED] Scaling TIFF loses pixels

Post by sacha »

I have a problematic TIFF which

a) does not display correctly in imdisplay.exe - the dimensions of the image are correct, but only a thin strip of the image is rendered on a transparent background
b) converts to JPEG correctly at full size - the output is the whole image
c) does not convert to JPEG correctly if scaled - the JPEG is also a thin strip

The TIFF is here:

ftp://ftp.ssl.co.uk/sacha/8332/2014AA80090.tif

Here's the scaled JPEG, and what it should look like:

Image Image


I'm using the portable ImageMagick on 32-bit Windows Vista: ImageMagick-6.8.9-6-Q16-x86-windows

To reproduce:

Code: Select all

imdisplay 2014AA80090.tif   # doesn't display correctly

convert 2014AA80090.tif full.jpg
imdisplay full.jpg          # displays correctly

convert 2014AA80090.tif -resize 400 small.jpg
imdisplay small.jpg         # doesn't display correctly
The full.jpg and small.jpg files produced on my PC are also on the FTP site: ftp://ftp.ssl.co.uk/sacha/8332/

I tried viewing the TIFF in a few other viewers. Photoshop and Accusoft's Active X viewer display the image correctly, as does an application of ours that uses FreeImage to display images. Windows explorer's tile preview (on the Vista PC) and FastStone Image Viewer display the strip - both are attempting to display a thumbnail, so perhaps they also scale incorrectly.
Last edited by sacha on 2014-08-08T03:26:16-07:00, edited 1 time in total.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Scaling TIFF loses pixels

Post by snibgo »

Your tiff file 2014AA80090.tif contains unassociated alpha. Many programs, including IM, treat this as opacity. To ignore it:

Code: Select all

convert 2014AA80090.tif -alpha off x.png
The image is encoded as AdobeRGB, so you might also want to convert it to sRGB:

Code: Select all

convert 2014AA80090.tif -alpha off -profile sRGB.icc x.png
snibgo's IM pages: im.snibgo.com
sacha
Posts: 17
Joined: 2012-04-12T14:37:19-07:00
Authentication code: 8675308

Re: Scaling TIFF loses pixels

Post by sacha »

Thanks. Does -alpha off only affect unassociated alpha, or all alpha? I.e. can I use it as a default for all images I process. Otherwise, is there a way I can detect unassociated alpha programatically?

Is there a reason why converting to JPEG behaves differently to scaling and then converting to JPEG?
sacha
Posts: 17
Joined: 2012-04-12T14:37:19-07:00
Authentication code: 8675308

Re: Scaling TIFF loses pixels

Post by sacha »

Looks like this topic covers the same issue exactly:

viewtopic.php?f=1&t=15572
Post Reply