[Magick-bugs] M++ crop, zoom, crop -> exception
David Harmon
7nr4ig802 at sneakemail.com
Thu May 24 13:34:07 PDT 2007
ImageMagick is way cool, thanks everybody.
However, the following throws an exception and I do not think it should.
I am using Magic++ with ImageMagick-6.3.4-2-Q8-windows-dll.exe
Windows XP and MSVC2003
The output is:
Crop from 200x100 to 100x100+100+0
Zoom from 100x100 to 200x200
Crop from 200x200 to 100x200+50+0
Caught exception: ImageMagick: geometry does not contain image `#000000'
My test case code is:
#include<Magick++.h>
#include <iostream>
using namespace std;
using namespace Magick;
int main()
{
try {
// Start with some image
Image foo(Geometry(200, 100, 0, 0), Color(0, 0, 0));
// take the right-hand half of it
Geometry crop1( foo.columns()/2, foo.rows(), foo.columns()/2, 0);
cout << "Crop from " << string(foo.size())
<< " to " << string(crop1) <<'\n';
foo.crop(crop1);
// Double size
Geometry zoom(foo.columns()*2, foo.rows()*2);
cout << "Zoom from " << string(foo.size())
<< " to " << string(zoom) <<'\n';
foo.zoom(zoom);
// foo.page(foo.size());
// take center vertical slice
Geometry crop2( foo.columns()/2, foo.rows(), foo.columns()/4, 0);
cout << "Crop from " << string(foo.size())
<< " to " << string(crop2) <<'\n';
foo.crop(crop2);
cout << "Result " << string(foo.size()) <<'\n';
} catch ( Exception &err ) {
cout << "Caught exception: " << err.what() << '\n';
}
}
More information about the Magick-bugs
mailing list