I use the ImageMagick library for image processing. I need to upload the image "bmp", convert it to jpeg, upload it to the buffer and send it over the network.
However, I cannot find any helper function in ImageMagick that can convert and store data in a buffer. I can write only in a file. Tried using Magick::Blob , but still useless.
The following code is used to download, convert, and write to a file:
Magick::Image img("Sample.bmp"); img.magick("jpeg"); img.write("Output.jpeg");
EDIT:
Used by Magick :: Blob as:
Magick::Blob myBlob; img.write(&myBlob); const void *myData = myBlob.data();
But here I canβt convert myData to const char* without conversion.
source share