Accessing the pixels of an image

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
madmage

Accessing the pixels of an image

Post by madmage »

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!
Post Reply