Center Gravity not working?
Posted: 2011-02-06T20:55:04-07:00
I have searched this topic a bunch and I have tried everything suggested, but still for some reason the image does not do a crop with a center gravity. Can anyone shed some light on how to fix this problem?
Code: Select all
- (UIImage *)applyEffect7:(UIImage *)i {
NSLog(@"applying effect seven");
MagickWandGenesis();
MagickWand * magick_wand = NewMagickWand();
MagickWand * mw_extra = NewMagickWand();
NSLog(@"**** BEFOER: %f x %f", i.size.width, i.size.height);
UIImage * source = [i scaledImageWithFrame:CGRectMake(0, 0, 250, 250)];
NSLog(@"**** SOURCE: %f x %f", source.size.width, source.size.height);
NSData * dataObject = UIImageJPEGRepresentation(source, 100); //UIImagePNGRepresentation([UIImage imageNamed:@"iphone.png"]);
MagickReadImageBlob(magick_wand, [dataObject bytes], [dataObject length]);
kGoToClean
// convert ./IMG_0001.jpg -gravity Center -crop 1936x1936 -quality 100 step1.jpg
MagickSetGravity(magick_wand, CenterGravity);
MagickCropImage(magick_wand, 250, 250, 0, 0);
kGoToClean