Page 1 of 1

Image Pixel Cache

Posted: 2008-03-25T13:21:35-07:00
by tomf
I don't really understand the Image Pixel Cache. I want to get my pixels in the format RGB - without success so far.

This works at the moment:

Code: Select all

Magick::Blob blob;
image.write(&blob, "RGB", 8);
blob.data() --> this is what I need
How can I achive this via the image pixel cache? I need exactly what blob.data() would give me but by using the pixel cache because the blob conversion takes about ~700ms for a 1400x1000 pixel jpg image. And the pixels are copied later to opengl so it's an unneseccary conversion.

Re: Image Pixel Cache

Posted: 2008-03-25T15:57:49-07:00
by magick
The fastest pixel accessor is getConst(), however it returns a PixelPacket type which is probably not what you want. Instead use write(x,y,columns,rows,map,type,pixels). Here you supply the pixel buffer and ideally you would access a scanline at a time, for example, image.write(0,0,width,1,"RGB",CharPixel,pixels).

Re: Image Pixel Cache

Posted: 2008-03-26T11:36:34-07:00
by tomf
thx! works fine.