Page 1 of 1

[CLOSED] Scaling TIFF loses pixels

Posted: 2014-08-07T09:55:16-07:00
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.

Re: Scaling TIFF loses pixels

Posted: 2014-08-07T11:02:20-07:00
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

Re: Scaling TIFF loses pixels

Posted: 2014-08-08T03:19:24-07:00
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?

Re: Scaling TIFF loses pixels

Posted: 2014-08-08T03:25:58-07:00
by sacha
Looks like this topic covers the same issue exactly:

viewtopic.php?f=1&t=15572