upside down image from MagickGetImageBlob on OSX

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
User avatar
magick
Site Admin
Posts: 10935
Joined: 2003-05-31T11:32:55-07:00

Post by magick » 2006-03-28T13:09:14-07:00

You have a few mistakes in your code. When you call MagickGetImageBlob() you need to specify an image format and depth so instead of
  • unsigned char * data = MagickGetImageBlob(magick_wand,&length);
you want

Code: Select all

MagickSetImageDepth(magick_wand,8);
MagickSetImageFormat(magick_wand,"RGB");
data = MagickGetImageBlob(magick_wand,&length);
However, a more efficient way is to call MagickGetImagePixels() which always returns raw image pixels.

To correct for the upside down image, simply call MagickFlipImage().

Post Reply