ImageMagick chokes on strange TIFF fields

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
ltls2

ImageMagick chokes on strange TIFF fields

Post by ltls2 »

Hi.

I'm trying to use ImageMagick (Magick++, actually) to process a load of TIFF files, but they all have an unknown field with tag 34680 (0x8778). It doesn't seem to affect their usage in other programs, as both OpenOffice and the GIMP (among others) can display them, with the GIMP giving a warning about the very same tag being unknown.

The problem arises when I try to open one of the files - both the newest (Windows) version from your website (6.4.2-1-Q16) and the older version which my development (Linux) system has packages installed for (6.3.5.10-2) exhibit this problem. The command-line utilities from both Windows and Linux load the image, but complain about this field and exit looking very unhappy and worded like they didn't actually do any conversion (they do convert it, however).

The program which I'm writing to do the processing just dies upon reading it, exiting back to the command line with an exception: "Caught exception: ImageMagick: L2BF0002.TIF: unknown field with tag 34680 (0x8778) encountered. 'TIFFReadDirectory'". I pretty much copied the image reading code from your Magick++ documentation: wrapping it in a try-catch pair like in the first example here, and that is what's causing the program to exit. My knowledge of C++ is extremely limited, so I don't know how to identify or deal with this special case.

I've got hundreds of image files like this, here's one of them.

Would someone please be able to tell me how to get around this little problem (other than removing the exception code)?

Thanks in advance.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: ImageMagick chokes on strange TIFF fields

Post by magick »

ImageMagick throws three types of exceptions, warning, error, and fatal. Your image throws a warning exception and these can safely be ignored. Your Magick++ program should check for warning exceptions and continue processing if it sees one.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: ImageMagick chokes on strange TIFF fields

Post by anthony »

You can tell it not to report 'warnings' using the -quiet Operational Control
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
ltls2

Re: ImageMagick chokes on strange TIFF fields

Post by ltls2 »

magick wrote:ImageMagick throws three types of exceptions, warning, error, and fatal. Your image throws a warning exception and these can safely be ignored. Your Magick++ program should check for warning exceptions and continue processing if it sees one.
Yep, this worked. I gave the imagefile.read() line of code its own try-catch pair for warning exceptions and it loads them all fine.

Thanks.
Post Reply