possible bug resizing a tiff file

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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

possible bug resizing a tiff file

Post by fmw42 »

Using ImageMagick 6.9.10.8 and 7.0.8.8 on Mac OSX Sierra, I have a layered tiff that resizes OK, but then does not look correct in Photoshop 19.1.5. In PS, only the top left corner seems to display whereas in IM and Mac PREVIEW, I see the whole file.

This was tested from the following post -- viewtopic.php?f=1&t=34465 -- that first raised the issue.

Original TIFF:
http://www.fmwconcepts.com/misc_tests/t ... iginal.tif

I have tried variations of the following two commands in both IM 6 and IM 7 and get the same results.

Code: Select all

convert Original.tif[0] -resize 410x426 fred_new2_6.tif

convert Original.tif -coalesce -resize 410x426 -layers merge +repage fred_new2_6.tif
The result is:
http://www.fmwconcepts.com/misc_tests/t ... new2_6.tif

When I open them in PS and take screen snaps, I get the following:

Original:
Image

Resized:
Image

I am not sure if this is due to a corrupt TIF or IM is not writing the correct file information about size to where PS needs it.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: possible bug resizing a tiff file

Post by snibgo »

I think there is a problem in Original.tif, or in the way IM reads it. Note that...

Code: Select all

convert Original.tif[0] -resize 410x426 fred_new2_6.tif
... should make a single image because of [0] but the output has three images.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug resizing a tiff file

Post by fmw42 »

With that command, I only got one output image on my Mac OSX Sierra and IM 6.9.10.8.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug resizing a tiff file

Post by fmw42 »

Additional information. After resizing with

Code: Select all

convert Original.tif -layers merge +repage  -resize 410x426 result2.tif
when I open the file in PS, it still have two layers. The first is mostly transparent but contains the logo. The second is the object part.

So the OP's original comment about not merging the layers is true.

The same happens with -flatten.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug resizing a tiff file

Post by fmw42 »

If I remove the first mostly transparent layer from the image in PS and save it, the after resizing in IM and opening it again in PS, it shows the full image.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: possible bug resizing a tiff file

Post by snibgo »

For me, v7.0.7-28 on Windows 8.1, IM is confused by the input file. Here, I've renamed Original.tif to be rotor.tif.

The following works fine:

Code: Select all

f:\web\im>%IMG7%magick identify rotor.tif
rotor.tif[0] TIFF 1330x1380 1330x1380+0+0 8-bit CMYK 8169170B 0.125u 0:00.312
rotor.tif[1] TIFF 1330x1380 1330x1380+0+0 8-bit CMYK 0.000u 0:00.016
rotor.tif[2] TIFF 276x323 276x323+199+407 8-bit CMYK 0.000u 0:00.016

f:\web\im>%IMG7%magick identify rotor.tif[0]
rotor.tif[0]=>rotor.tif TIFF 1330x1380 1330x1380+0+0 8-bit CMYK 8169170B 0.078u
0:00.078

f:\web\im>%IMG7%magick rotor.tif[0] info:
rotor.tif[0] TIFF 1330x1380 1330x1380+0+0 8-bit ColorSeparation CMYK 8169170B 0.
156u 0:00.296
Okay so far. But when we convert rotor.tif[0]:

Code: Select all

f:\web\im>%IMG7%magick rotor.tif[0] x.tiff

f:\web\im>%IMG7%magick identify x.tiff
x.tiff[0] TIFF 1330x1380 1330x1380+0+0 8-bit CMYK 9.52169MiB 0.063u 0:00.062
x.tiff[1] TIFF 1330x1380 1330x1380+0+0 8-bit CMYK 0.000u 0:00.000
x.tiff[2] TIFF 276x323 276x323+199+407 8-bit CMYK 0.000u 0:00.000
[1] and [2] work okay, but not [0].
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug resizing a tiff file

Post by fmw42 »

Yes, I get the same thing. IM will not select layers in TIFF files. I think IM cannot handle layer tiffs, only multipage tiffs.

I had submitted a bug report about layer tif handling a long time ago. I guess it has not yet been worked on.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: possible bug resizing a tiff file

Post by fmw42 »

I do not know if layered tiffs have a flattened layer like PSD files. But ignoring the flattened layer [0] and merging seems to work for me.

convert original.tif[1-2] -layers merge +repage -resize 410x426 result.tif

When I open result.tif in PS, it looks fine and has only one layer.
Post Reply