Page 1 of 1

How to access Image raw data

Posted: 2013-03-18T21:12:05-07:00
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!