473,722 Members | 2,397 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: Image grab in Python

On Sun, May 4, 2008 at 5:28 PM, Valerio Valerio <vd****@gmail.c omwrote:
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.

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.
Jun 27 '08 #1
0 1936

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6908
by: Gey-Hong Gweon | last post by:
Is there a way to copy a PIL image to windows clipboard (as a dib image or a bitmap, I suppose)? What I would like to accomplish is to do a fast copy and paste of images from my python application to a windows application such as powerpoint. A slower way is to use files, which is what I am doing at the moment. Thanks in advance.
3
3169
by: Catalin Lungu | last post by:
Hi, Can anybody help me to implement the following VB code in Python. Thanks in advance. Private Declare Function SendMessage Lib "user32.dll" Alias _ "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _ ByVal wParam As Long, ByVal lParam As Long) As Long Private Const WM_PAINT = &HF Private Const WM_PRINT = &H317
10
7399
by: John Smith | last post by:
I know that uploading an image to a database has been covered, oh, about 3 trillion times. However, I haven't found anything covering uploading to a MySQL database with .net. Please don't recommend storing the image to the filesystem and only keeping a pointer to that in the table. I want to dump the image to a table. My code dumps the data into the table, however, I get the following error when trying to view the image "the image ......
8
1472
by: Lars Netzel | last post by:
Hey! I wrote a message yersterday and got some good answers and have now managed to generate a nice image. The problem is that it's all generated in an Images.Aspx file and I don't really want that. I am writing a WebControl Library and I want to generate everything from there... In the Render Sub of the Control I output some HTML and there I need to reference to a file in the <img> element, is there anyway to NOT have to point to a...
10
4191
by: abcd | last post by:
I have PIL 1.1.5 on python 2.4.1 and I am attempting to get a smaller (file size) of an image. for example: im = ImageGrab.grab() im.save("tmp.gif") ---- about 1.7mb im.save("tmp.jpeg") ---- about 290kb anyways I want to save the image as a GIF, but not have it be so
1
2395
by: Lastknight | last post by:
Hi all, i am looking for your help regarding this topic... I am trying to download a image from the web through perl program. I have used Image::Grab module for that task,through the module i am able to download the image.... But my problem is i want to get that image to be stored in the particular file path,(eg)" /home/image" ..I dont know how to do this...can some one heil me to overcome this problem..
1
3526
by: nanaalwi | last post by:
Hi, Currently I'm developing a software using VB.net that can grab an image using Matrox Morphis card and display it in a PictureBox. The software can grab the image already and display it in the form (Imports Matrox.ActiveMil). But the problem is I need to display the image in the PictureBox but I don't know how. The coding to grab the image is as follows: ActiveMILApplication = CreateObject("MIL.Application")
0
158
by: David | last post by:
On Sun, May 4, 2008 at 4:25 PM, Valerio Valerio <vdv100@gmail.comwrote: You might be able to use this tool: http://freshmeat.net/projects/gtkshots/ David.
2
3532
by: dschu012 | last post by:
There are images from the web that are PNG's that I am trying to grab. I seem to be able to grab them however when I do they are not the same size (in bytes) as the image that is stored on the web. For instance one image I am trying to grab is 2666 bytes, when I grab it the image become 3190 bytes. I am able to save it on my computer if I just right click it in my web browser and it turns out to be the right number of bytes but how can I do this...
0
8739
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9238
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9157
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8052
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6681
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5995
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4762
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3207
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2147
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.