Hi,
dont know if this is possible or if anyone has experience with this.
I have an existing app that uses cairo.
I need to modify a cairo "image surface" IN MEMORY before writing to disk.
I can get an unsigned char pointer to the data in memory using cairos "image_surface_get_data" function.
However I dont know the length, since cairo apparently doesnt provide this info.
Im guessing that it should just be (pixel_height)*(pixel_width)*(4) for RGBA right??? need help on this...
Also, Im assuming that I would simply pass this info to MagickReadImageBlob(), correct???
something like "MagickReadImageBlob(mw,blobptr,3600)"
also need help figuring out how to this...
last question: the in-memory image is a png file.
Im not clear if the image has 'meta-data' that IM can read & figure out, or if I have to manually set the image attributes in my magickwand prior (or after?) reading the blob...how does this work???
Please help, thanks...
reading raw (cairo surface) image data from memory
Re: reading raw (cairo surface) image data from memory
Check out the source module coders/svg.c. In it we convert a cairo_surface_t to MagickCore Image structure. It should provide enough insight to help you with your own code.
Re: reading raw (cairo surface) image data from memory
ok, thanks.
Im taking a look at the example code, but honestly, it seems pretty complex & low-level.
I was hoping to be able to stay at a higher level with wand.
is this do-able in wand, or will I be forced to work in magick-core?
I see that theres a "MagickImportImagePixels" function.
would this achieve what I need?
Im taking a look at the example code, but honestly, it seems pretty complex & low-level.
I was hoping to be able to stay at a higher level with wand.
is this do-able in wand, or will I be forced to work in magick-core?
I see that theres a "MagickImportImagePixels" function.
would this achieve what I need?
Re: reading raw (cairo surface) image data from memory
All MagickCore methods are available from MagickWand. We encourage you to continue to use MagickWand. You can create an Image* image with MagickCore API calls similar to the method outlined in the coders/svg.c module and import it into MagickWand with the NewMagickWandFromImage() method.
Re: reading raw (cairo surface) image data from memory
I apologize, I still need assistance.
I have been looking at the svg example code, but it looks very confusing, Im not clear on how the cairo surface is being converted to an imagemagick image.
What is the simplest way that I can convert a cairo_image_surface_t to an imagemagick image????
was I incorrect to believe that I can simply pass a pointer to the cairo image data in memory to an imagemagick function???
please help, Im stuck...
Thanks
I have been looking at the svg example code, but it looks very confusing, Im not clear on how the cairo surface is being converted to an imagemagick image.
What is the simplest way that I can convert a cairo_image_surface_t to an imagemagick image????
was I incorrect to believe that I can simply pass a pointer to the cairo image data in memory to an imagemagick function???
please help, Im stuck...
Thanks
Re: reading raw (cairo surface) image data from memory
The example in magick/svg.c is all we have to offer because we know it works. Perhaps another user may be of assistance.