Creating a Blob
Posted: 2008-07-12T21:08:12-07:00
Does someone know how to create a Magick++ Blob with raw image data such as RGBA? If someone has a code sniplet, that would be great too.
Use https://github.com/ImageMagick/ImageMagick/discussions instead.
https://imagemagick.com/discourse-server/
https://imagemagick.com/discourse-server/viewtopic.php?t=11666
Code: Select all
char buffer1[4147200]; // enough for exactly one image's worth of bytes in this example
void* data1 = &buffer1[0]; // A void pointer to be passed to the Blob constructor
// Open image file
std::ifstream input_file("frame1.uyvy", std::ios::in | std::ios::binary);
// Read data into buffer
input_file.read (&buffer1, 4147200);
// Create Blob with data from buffer
Magick::Blob tempDataStore1(data1, 4147200);
// Create image from Blob
Magick::Image image1(tempDataStore1, "1920x1080", 3, "UYVY");
// Write that image as a png file
image1.write( "fromBlob.png");
Yes, I am. I'm using it because that's a depth appropriate to the raw images I wrote this code for.kh263 wrote:Are you using a depth of 3 in this example? If so, why?