libmagick++ throws exception on libtiff warning
Posted: 2014-07-28T09:24:43-07:00
This may be related to the bug discussed in thread 23415:
viewtopic.php?t=23415
With certain semi-broken TIFF files, Magick::readImages will throw an exception due to libTIFF generating a warning about an invalid line:
However, the TIFF file is readable and can be converted (to PDF, for example) using the command-line "convert" utility:
I suspect that what is happening is that Magick++ is throwing an exception, even though this is just a warning which does not prevent successful operation. Or am I missing some parameter to tell ImageMagick to ignore such warnings?
viewtopic.php?t=23415
Code: Select all
try
{
std::vector<Magick::Image> pages;
Magick::readImages (&pages, "/var/tmp/generates-warning-fax.tiff");
}
catch (std::exception& e)
{
std::cout << e.what();
}
Code: Select all
Magick: /var/tmp/generates-warning-fax.tiff: Line length mismatch at line 2245 of strip 0 (got 1740, expected 1728). `Fax3Decode1D' @ warning/tiff.c/TIFFWarnings/857,2
Code: Select all
$ convert generates-warning-fax.tiff generates-warning-fax.pdf
convert.im6: generates-warning-fax.tiff: Line length mismatch at line 2245 of strip 0 (got 1740, expected 1728). `Fax3Decode1D' @ warning/tiff.c/TIFFWarnings/768.
$ ls -l generates-warning-fax.*
-rw-r--r-- 1 hexetic users 738790 Jul 28 12:18 generates-warning-fax.pdf
-rw------- 1 hexetic users 711572 Jul 28 10:37 generates-warning-fax.tiff