Convert Image raw data of Unit8_t type to JPEG
Posted: 2019-08-26T15:31:22-07:00
Hi
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:
P.S buffer size is 2560 X 1600 x (32 >>3) (where 32 is the number of bits per pixel). I am setting the depth to 32 bits after I am using MagickConstituteImage()
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
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