Image Pixel Cache

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
tomf

Image Pixel Cache

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Image Pixel Cache

Post 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).
tomf

Re: Image Pixel Cache

Post by tomf »

thx! works fine.
Post Reply