Page 1 of 1

How to use MagickWand to effectiviely with X11 libraries

Posted: 2011-07-28T02:05:02-07:00
by Achuthan
I wanted to get the desktop screen captured using the xlib and then modify some pixels in the zpixmap using imagemagick and later on return it back to the XImage structure.

Is there any way to do that. I am only seeing files modified none from on memory modification.

Any help is greatly appreciated. Thanks in advance.

Re: How to use MagickWand to effectiviely with X11 libraries

Posted: 2011-07-30T13:46:40-07:00
by Achuthan
Any one got any idea or there isn't a way to do that ?

Re: How to use MagickWand to effectiviely with X11 libraries

Posted: 2011-07-30T14:02:22-07:00
by el_supremo
If the image data is just a simple array in memory, you can use MagickConstituteImage to read the data in to a magick wand. You can then manipulate it anyway you like.
http://studio.imagemagick.org/api/magic ... ituteImage

Once you've processed the pixels you can export them back into a memory array using MagickExportImagePixels.
http://studio.imagemagick.org/api/magic ... magePixels

Pete

Re: How to use MagickWand to effectiviely with X11 libraries

Posted: 2011-08-26T01:17:29-07:00
by Achuthan
Thank you !!!

But now when I started using the api, am getting this error. myImage is an XIMAGE.

821 MagickBooleanType mb=MagickConstituteImage(wand, myImage->width, myImage->height, "RGB", CharPixel, rfb_fb);
(gdb) n

Program received signal SIGSEGV, Segmentation fault.
ImportImagePixels (image=0xae21a0, x_offset=0, y_offset=0, columns=800, rows=600,
map=<value optimized out>, type=<value optimized out>, pixels=0x7ffff174c010)
at magick/pixel.c:1943
1943 q->green=ScaleCharToQuantum(*p++);

Re: How to use MagickWand to effectiviely with X11 libraries

Posted: 2011-08-26T08:24:49-07:00
by el_supremo
The only thing I can suggest is that you check that rfb_fb points to a valid area of memory. The debug info shows that the image is 800x600 and you specified "RGB" and CharPixel so IM will try to import 1,440,000 bytes. Make sure that rfb_fb really does point to an area that is at least that large.

Pete