Problems when converting TIFF files that contain tag 37724

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
rwruck
Posts: 7
Joined: 2011-11-09T10:55:59-07:00
Authentication code: 8675308

Problems when converting TIFF files that contain tag 37724

Post by rwruck »

Hi,

there seems to be a problem when converting TIFF files when the source contains the Photoshop ImageSourceData tag (37724).
I've used a command line like this (IM 6.7.2.0) to compress a TIFF file:

Code: Select all

convert -compress JPEG source.tif destination.tif
Reading the input file shows the usual warnings:

Code: Select all

source.tif: unknown field with tag 37724 (0x935c) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/707
That's not a problem so far, but when writing the output file, there are errors:

Code: Select all

destination.tif: Unknown tag 37724. `TIFFSetField' @ error/tiff.c/TIFFErrors/497
The output file is written BUT it does not contain the 37724 tag AND convert exits with code 1 which indicates a failure.
Looking at tiff.c, there's the following code which seems to be intended for handling this tag:

Code: Select all

    if (LocaleCompare(name,"tiff:37724") == 0)
      (void) TIFFSetField(tiff,37724,(uint32)GetStringInfoLength(profile),
        GetStringInfoDatum(profile));
This does not work, because 37724 is a custom tag. You'd have to register it using TIFFSetTagExtender as outlined here: http://www.asmail.be/msg0054585832.html

I'd assume that the declaration of the ImageSourceData tag would be something like

Code: Select all

{ 37724, -1, -1, TIFF_UNKNOWN, FIELD_CUSTOM, 1, 1, "ImageSourceData" }
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Problems when converting TIFF files that contain tag 377

Post by magick »

We can reproduce the problem you posted and will get a patch into ImageMagick 6.7.3-5 Beta within a few days. Thanks.

Can you post a URL to one of your TIFF images with the 37724 tag so we can test our solution?
rwruck
Posts: 7
Joined: 2011-11-09T10:55:59-07:00
Authentication code: 8675308

Re: Problems when converting TIFF files that contain tag 377

Post by rwruck »

Thanks for the quick reply.

Here is an image: http://www.rw-it.net/public/37724/test.tiff

Here is a patch I made that works for me: http://www.rw-it.net/public/37724/patch ... iff.c.diff
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Problems when converting TIFF files that contain tag 377

Post by magick »

We have the patch in ImageMagick 6.7.3-5 Beta and the Subversion trunk. For now we treat the 37724 tag as a binary blob. In the future, we'll add code to decode the blob and extract the metadata.
Post Reply