MagickWand Gravity Crop Bug? MagickTransformImage?
Posted: 2008-09-03T19:53:34-07:00
My goal is to do a gravity-crop, like "convert input.jpg -gravity center -crop 50x50+0+0 output.jpg" using MagickWand.
I believe this code should do it, but it doesn't honor my gravity request, instead I always get the top left corner of the image.
Either this is a bug, or there is some other method I am unaware of to do gravity crops with MagickWand.
Tested on 6.4.3-6.
Any thoughts would be appreciated.
--maqr
I believe this code should do it, but it doesn't honor my gravity request, instead I always get the top left corner of the image.
Either this is a bug, or there is some other method I am unaware of to do gravity crops with MagickWand.
Code: Select all
#include <wand/MagickWand.h>
int main()
{
MagickWand *m_wand = NewMagickWand();
MagickWand *t_wand = NewMagickWand();
MagickReadImage( m_wand, "input.jpg" );
MagickSetGravity( m_wand, CenterGravity );
t_wand = MagickTransformImage( m_wand, "50x50+0+0", "" );
MagickWriteImage( t_wand, "output.jpg" );
m_wand = DestroyMagickWand( m_wand );
return 0;
}
Any thoughts would be appreciated.
--maqr