How to access Image raw data

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
xtang
Posts: 3
Joined: 2013-03-18T21:01:48-07:00
Authentication code: 6789

How to access Image raw data

Post by xtang »

hi, I did some transformation of image through Magick++, and at last I want to get the raw data of the processed image, which way is best practise? For example,

Code: Select all

Blob blob(src, lenOfSrc);
Image image(blob);
image.resize(targetGeo);
...

// for now, i use the following logic to get the raw data:
Blob tmpBlob;
image.write(&tmpBlob);
void* data = tmpBlob.data();
size_t length = tmpBlob.length();
But I found image.write(Blob) is not good idea in multi-thread. It costs more than 2s when concurrent is more than 1, but less than 10ms when concurrent is 1.

I do not know if i just do the wrong way, please correct me.

thanks!
Post Reply