I am having raw data in an image buffer of uint8_t type. I am trying to convert this data to image format (JPG preferably). I am using MagickConstituteImage() to do this.
Code Snippet for reference:
Code: Select all
wand = NewMagickWand();
MagickConstituteImage(wand,2560,1600,"RGB",CharPixel,buffer);
MagickSetImageDepth(wand, 32);
MagickSetImageColorspace(wand, RGBColorspace);
MagickSetImageFormat(wand, "jpg");
MagickSetImageExtent(wand, 1920, 1080));
MagickWriteImage(wand, "output.jpg");
ClearMagickWand(wand);
I am able to get an image but its faded and looks like a grayscale image. I cannot create a blob using MagickReadImageBlob() before calling MagickConstituteImage() because there are no images in my wand at first. Any suggestions on how can I fix it or if my sequence of function calls is wrong?
Thanks