I am getting the size of image object via its signature property and then exporting it via NSData where my App Crashes.
Here is my code :
Code: Select all
-(UIImage *)applyAlgo {
MagickWandGenesis();
MagickWand * magick_wand = NewMagickWand();
NSData *imgData = UIImagePNGRepresentation(self.image);
MagickReadImageBlob(magick_wand, [imgData bytes], [imgData length]);
Image *image = GetImageFromMagickWand(magick_wand);
ExceptionInfo *exceptionInfo = AcquireExceptionInfo();
Image * newImage = InterpolativeResizeImage(image, image->columns, image->rows, BicubicInterpolatePixel, exceptionInfo);
size_t mySize = newImage->signature;
NSData *data = [[NSData alloc]initWithBytes:newImage length:mySize]; // App Crashes Here
free(newImage);
magick_wand = DestroyMagickWand(magick_wand);
MagickWandTerminus();
UIImage * finalImage = [[UIImage alloc] initWithData:data];
return finalImage;
}