Conversion from Tiff to Jpeg generates three files.

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
cagedmantis
Posts: 4
Joined: 2011-06-21T12:28:01-07:00
Authentication code: 8675308

Conversion from Tiff to Jpeg generates three files.

Post by cagedmantis »

The conversion of a tiff file to a jpeg format has not worked as we expected. Instead of creating one output jpeg file, three are created with a "-0", "-1" and "-2" appended to the file name before the extension.

When we run the following command:

Code: Select all

convert Test_image2.TIF jpg:image2.jpg
On this file: http://www.cagedmantis.com/temp/Test_image.TIF, we recieve the following errors:

Code: Select all

C:\scripts\apostle\yay>convert Test_image.TIF jpg:image1.jpg
Magick: Test_image.TIF: wrong data type 2 for "XMLPacket"; tag ignored. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/706.
Magick: Test_image.TIF: wrong data type 2 for "RichTIFFIPTC"; tag ignored. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/706.
Magick: Test_image.TIF: invalid TIFF directory; tags are not sorted in ascending order. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/706.
Magick: Test_image.TIF: unknown field with tag 34152 (0x8568) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/706.
And the command produces these three jpeg files:
http://www.cagedmantis.com/temp/image1-0.jpg
http://www.cagedmantis.com/temp/image1-1.jpg
http://www.cagedmantis.com/temp/image1-2.jpg

Imagemagick is installed on a Windows Server 2008 R2 Enterprise X64


convert -list configure:

Code: Select all

Path: [built-in]

Name          Value
-------------------------------------------------------------------------------
NAME          ImageMagick

Path: C:\Program Files\ImageMagick-6.7.0-Q16\config\configure.xml

Name          Value
-------------------------------------------------------------------------------
CC            vs10
COPYRIGHT     Copyright (C) 1999-2011 ImageMagick Studio LLC
DELEGATES     bzlib freetype jpeg jp2 lcms png tiff x11 xml wmf zlib
FEATURES      OpenMP
HOST          Windows
LIB_VERSION   0x670
LIB_VERSION_NUMBER 6,7,0,0
NAME          ImageMagick
RELEASE_DATE  2011-06-01
VERSION       6.7.0
WEBSITE       http://www.imagemagick.org

Path: configure.xml

Name          Value
-------------------------------------------------------------------------------
CC            vs10
COPYRIGHT     Copyright (C) 1999-2011 ImageMagick Studio LLC
DELEGATES     bzlib freetype jpeg jp2 lcms png tiff x11 xml wmf zlib
FEATURES      OpenMP
HOST          Windows
LIB_VERSION   0x670
LIB_VERSION_NUMBER 6,7,0,0
NAME          ImageMagick
RELEASE_DATE  2011-06-01
VERSION       6.7.0
WEBSITE       http://www.imagemagick.org
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Conversion from Tiff to Jpeg generates three files.

Post by fmw42 »

Your tiff file has 3 layers and jpg does not support layers, so IM makes three images from it. If you only want one image for a given frame use

convert image.tif[0] image.jpg

that will take the first frame and convert it.
cagedmantis
Posts: 4
Joined: 2011-06-21T12:28:01-07:00
Authentication code: 8675308

Re: Conversion from Tiff to Jpeg generates three files.

Post by cagedmantis »

Or I can just flatten the layers with "-layers flatten"

The image itself is not showing up with layers in my version of photoshop. Thanks for the help.
cagedmantis
Posts: 4
Joined: 2011-06-21T12:28:01-07:00
Authentication code: 8675308

Re: Conversion from Tiff to Jpeg generates three files.

Post by cagedmantis »

I am still a bit confused. I have other files which have multiple layers and they are converting without a problem. There is a subgroup of files which have these issues. When opened in Photoshop, these files do not have multiple layers.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Conversion from Tiff to Jpeg generates three files.

Post by fmw42 »

using IM identify, it sees 3 layers (frames)


identify Test_image.TIF
Test_image.TIF[0] TIFF 1317x2000 1317x2000+0+0 8-bit DirectClass 8.456MB 0.010u 0:00.019
Test_image.TIF[1] TIFF 337x512 337x512+0+0 8-bit DirectClass 8.456MB 0.000u 0:00.000
Test_image.TIF[2] TIFF 84x128 84x128+0+0 8-bit DirectClass 8.456MB 0.000u 0:00.000


I cannot see any layers or other factors that would account for them either in my old PS CS.

However, if you just copy the first layer (which is usually the flattened layer from PS), it looks like what is displayed in PS.

convert Test_image.TIF[0] Test_image_0.jpg


If you do

convert Test_image.TIF Test_image-%d.jpg

You get all 3 layers. With jpg, you an even leave off the -%d and get the same result as jpg does not support layers and produces multiple files.

The other layers are reduced resolution version of this layer. So what you have is a PTIF (pyramid tiff). And I have no idea how PS handles that. IM will give you all or any resolution version(s) you want to export (convert).

Google for PTIF for more information.


The other messages are warnings telling you there is some fields/tags in the file that IM does not recognize (perhaps the ptif info), but warnings do not hurt because they are about such tags and don't affect the image. You can suppress them by using -quiet
cagedmantis
Posts: 4
Joined: 2011-06-21T12:28:01-07:00
Authentication code: 8675308

Re: Conversion from Tiff to Jpeg generates three files.

Post by cagedmantis »

Thanks for pointing me in the right direction.
Post Reply