Disable assert/abort
Posted: 2011-08-16T08:57:18-07:00
Using magick++, is it possible to disable the assertions/aborts on corrupt image reads without modifying the library? It seems strange that the library would throw an exception and assert/abort.
I have a daemon that is processing images in the background. I don't want the daemon to die just because it encounters a single corrupt image. I do want to know when it encounters a corrupt image, but I want to catch the error and continue.
Ubuntu 10.04
Default libmagick++-dev version from the repositories
$ echo `dpkg -l |grep magick++-dev`
ii libmagick++-dev 7:6.5.7.8-1ubuntu1.1 object-oriented C++ interface to ImageMagick
Thanks.
Code: Select all
Image img;
try
{
img.read(argv[1]);
}
catch (exception& ex)
{
cout << "Caught: " << ex.what() << endl;
}
Code: Select all
Caught: Magick: Corrupt JPEG data: 3052 extraneous bytes before marker 0xd9 `2011-02-27_16-04-00_280.jpg' @ jpeg.c/EmitMessage/227
Not continuing - bad image.
imageTest: magick/semaphore.c:288: LockSemaphoreInfo: Assertion `semaphore_info != (SemaphoreInfo *) ((void *)0)' failed.
Aborted
Ubuntu 10.04
Default libmagick++-dev version from the repositories
$ echo `dpkg -l |grep magick++-dev`
ii libmagick++-dev 7:6.5.7.8-1ubuntu1.1 object-oriented C++ interface to ImageMagick
Thanks.