Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Output error:
terminate called after throwing an instance of 'Magick::WarningCoder' what(): ImageMagick: 001.TIF: Line length mismatch at line 0 of strip 0 (got 4410, expected 2704). `Fax4Decode'
We tried this program with ImageMagick 6.4.5-3 and it behaved as expected. Does it work for you? If not, post a URL to your image so we can download and reproduce the problem.
#include <Magick++.h>
#include <string>
#include <iostream>
#include <vector>
using namespace std;
using namespace Magick;
int main( int /*argc*/, char ** argv)
{
Magick::Image image;
try {
// Construct an image instance first so that we don't have to worry
// about object construction failure due to a minor warning exception
// being thrown.
Magick::Image image;
try {
// Try reading image file
image.read("001.tif");
}
catch( Magick::WarningCoder &warning )
{
// Process coder warning while loading file (e.g. TIFF warning)
// Maybe the user will be interested in these warnings (or not).
// If a warning is produced while loading an image, the image
// can normally still be used (but not if the warning was about
// something important!)
cerr << "Coder Warning: " << warning.what() << endl;
}
catch( Magick::Warning &warning )
{
// Handle any other Magick++ warning.
cerr << "Warning: " << warning.what() << endl;
}
catch( Magick::ErrorBlob &error )
{
// Process Magick++ file open error
cerr << "Error: " << error.what() << endl;
}
try {
image.rotate(90);
image.write("outfile");
}
catch ( Magick::Exception & error)
{
// Handle problem while rotating or writing outfile.
cerr << "Caught Magick++ exception: " << error.what() << endl;
}
}
catch( std::exception &error )
{
// Process any other exceptions derived from standard C++ exception
cerr << "Caught C++ STD exception: " << error.what() << endl;
}
catch( ... )
{
// Process *any* exception (last-ditch effort). There is not a lot
// you can do here other to retry the operation that failed, or exit
// the program.
}
cout << "bye bye" << endl;
}