Conversion of UIImage to Image* in iOS

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
anachn91
Posts: 1
Joined: 2013-07-29T00:24:45-07:00
Authentication code: 6789

Conversion of UIImage to Image* in iOS

Post by anachn91 »

I have a UIImage on which I am trying to apply auto gamma correction using the function: AutoGammaImage(Image *).
When I pass the UIImage directly to the function after bridge casting, I get the following error:

Assertion failed: (image->signature == MagickSignature), function GetImageChannelMean, file magick/statistic.c, line 1215.

Please tell me how should I convert the UIImage to an Image* for passing to this function.
mrugraj
Posts: 2
Joined: 2014-01-02T22:14:28-07:00
Authentication code: 6789

Re: Conversion of UIImage to Image* in iOS

Post by mrugraj »

Code: Select all

UIImage *sourceImage; // Your UIImage
    NSData *imgData=UIImagePNGRepresentation(sourceImage);
    MagickReadImageBlob(mw, [imgData bytes], [imgData length]);
    Image *image=GetImageFromMagickWand(mw);
Post Reply