How to use MagickWand to effectiviely with X11 libraries

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
Achuthan
Posts: 3
Joined: 2011-07-28T01:49:44-07:00
Authentication code: 8675308

How to use MagickWand to effectiviely with X11 libraries

Post by Achuthan » 2011-07-28T02:05:02-07:00

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.

Achuthan
Posts: 3
Joined: 2011-07-28T01:49:44-07:00
Authentication code: 8675308

Re: How to use MagickWand to effectiviely with X11 libraries

Post by Achuthan » 2011-07-30T13:46:40-07:00

Any one got any idea or there isn't a way to do that ?

el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: How to use MagickWand to effectiviely with X11 libraries

Post by el_supremo » 2011-07-30T14:02:22-07:00

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
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.

Achuthan
Posts: 3
Joined: 2011-07-28T01:49:44-07:00
Authentication code: 8675308

Re: How to use MagickWand to effectiviely with X11 libraries

Post by Achuthan » 2011-08-26T01:17:29-07:00

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++);

el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: How to use MagickWand to effectiviely with X11 libraries

Post by el_supremo » 2011-08-26T08:24:49-07:00

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
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.

Post Reply