Image grab in Python

Valerio Valerio vdv100 at gmail.com
Sun May 4 13:57:28 EDT 2008


Hi,

2008/5/4 David <wizzardx at gmail.com>:

> On Sun, May 4, 2008 at 5:28 PM, Valerio Valerio <vdv100 at gmail.com> wrote:
> > I can grab the image,  I need a way of grab the region size with the
> mouse,
> > a easy way of the user select a region of the image to analyze,
> something
> > like the  "Rectangle selection tool" of gimp.
> >
>
> I assume what you want to do is allow the user to drag the mouse
> across your desktop, and your program, running in the background,
> picks this up? As opposed to the user making a rectangular selection
> entirely within your app.


What I want is display a window with a image, the user select a region of
the image, and the region value is passed to my program, my program slice
the image region, and analyze it.

I think the Xlib libraries can help in my task, thanks for the help :)

Cheers,

-- 
Valério Valério

http://www.valeriovalerio.org


>
> I think the simplest way to do this is to capture the entire screen,
> then show it as an image on a window covering the entire screen (eg:
> fullscreen mode, or a regular window without decorations).  Then
> listen for mouse events. There should be a way to show the 'rectangle
> elastic band' at the same time. Otherwise just draw a rectangle
> between where the user first clicked and where the mouse is now (until
> they release the mouse button).
>
> Another way would be to listen to all events sent through X, and act
> based on the mouse events. VNC does something similar.
>
> A good starting point would be the Python xlib libraries:
>
> http://python-xlib.sourceforge.net/
>
> David.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080504/7c8e750d/attachment.html>


More information about the Python-list mailing list