Image::read warnings

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
dans888
Posts: 1
Joined: 2012-09-24T11:58:51-07:00
Authentication code: 67789

Image::read warnings

Post by dans888 »

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:

Code: Select all

try
{
	_image->read( filePtr );
}
catch( Magick::Warning &warning )
{
	// ignore warnings
}
I diffed the ImageMagick source and I noticed that Image.cpp's read changed from:
...

Code: Select all

  replaceImage( image );
  throwException( exceptionInfo );
  if ( image )
    throwException( image->exception );
  (void) DestroyExceptionInfo( &exceptionInfo );
to
...

Code: Select all

  if ( image )
    throwException( image->exception );
  throwException( exceptionInfo );
  (void) DestroyExceptionInfo( &exceptionInfo );
  replaceImage( image );
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
Post Reply