Accessing the pixels of an image
Posted: 2009-07-04T11:20:24-07:00
I'm not quite sure to have understood how the getPixels mechanism works.
This is what I am doing:
Image img(320, 240, "RGB", Magick::CharPixel, pixels);
/* some image editing here */
memcpy(mybuffer, img.getConstPixels(0, 0, 320, 240), 320*240*3);
but in mybuffer there is something related to the image, but it seems to be not RGB or the order I am expecting (R, G, B, R, G, B, etc.)
and, another question, what is the relationship between the "map_" parameter of the constructor ("RGB") and imageType() and colorspaceType() ??
thanks!
This is what I am doing:
Image img(320, 240, "RGB", Magick::CharPixel, pixels);
/* some image editing here */
memcpy(mybuffer, img.getConstPixels(0, 0, 320, 240), 320*240*3);
but in mybuffer there is something related to the image, but it seems to be not RGB or the order I am expecting (R, G, B, R, G, B, etc.)
and, another question, what is the relationship between the "map_" parameter of the constructor ("RGB") and imageType() and colorspaceType() ??
thanks!