Image::read warnings
Posted: 2012-09-25T10:13:48-07:00
Hi,
I just upgraded from ImageMagick 6.7.1 to 6.7.9. I have some code that was reading images using Magick++ and noticed that some of my unit tests were failing because certain TIFF files didn't load anymore. These particular TIFF files are valid, but generated warnings when loaded. The "convert" tool has no problem converting them (displaying the warning), but the Magick++ library doesn't load them any more.
The loading code that I'm using (which worked in 2.7.1) is trivial:
I diffed the ImageMagick source and I noticed that Image.cpp's read changed from:
...
to
...
Hence, in the new code, if an exception (including warnings) happens, it won't replace the image (and possibly leak memory??). I verified that if I change the code back to the original code, it will properly load the image. In addition, other read variant (e.g., the Blob-based one and ConsistuteImage one) still call replaceImage() before throwing exceptions.
Is this new behavior correct? If so, is there some way of turning off exceptions for warnings? I scanned through the code but did not see anything obvious (at least at the Magick++ level).
Thanks!
-- Dan
I just upgraded from ImageMagick 6.7.1 to 6.7.9. I have some code that was reading images using Magick++ and noticed that some of my unit tests were failing because certain TIFF files didn't load anymore. These particular TIFF files are valid, but generated warnings when loaded. The "convert" tool has no problem converting them (displaying the warning), but the Magick++ library doesn't load them any more.
The loading code that I'm using (which worked in 2.7.1) is trivial:
Code: Select all
try
{
_image->read( filePtr );
}
catch( Magick::Warning &warning )
{
// ignore warnings
}
...
Code: Select all
replaceImage( image );
throwException( exceptionInfo );
if ( image )
throwException( image->exception );
(void) DestroyExceptionInfo( &exceptionInfo );
...
Code: Select all
if ( image )
throwException( image->exception );
throwException( exceptionInfo );
(void) DestroyExceptionInfo( &exceptionInfo );
replaceImage( image );
Is this new behavior correct? If so, is there some way of turning off exceptions for warnings? I scanned through the code but did not see anything obvious (at least at the Magick++ level).
Thanks!
-- Dan