473,786 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

pixel colour on screen

Could anyone help me, I'm a python noob and need some help. im trying
to find some code that will, given a screen co-ordinate, will give me
the colour of that pixel in RGB. i have found a lot about getting the
pixel colour from a picture file with a given co-ordinate, but is it
possible to do it from the whole screen output regardless what
application the selected pixel is in?

any help would be help.

thanks, Chris
Jun 28 '08 #1
4 3566

Dennis Lee Bieber wrote:
On Sat, 28 Jun 2008 11:47:46 -0700 (PDT), cj*******@hotma il.com
declaimed the following in comp.lang.pytho n:
>Could anyone help me, I'm a python noob and need some help. im trying
to find some code that will, given a screen co-ordinate, will give me
the colour of that pixel in RGB. i have found a lot about getting the
pixel colour from a picture file with a given co-ordinate, but is it
possible to do it from the whole screen output regardless what
application the selected pixel is in?
Such capability differs with OS and GUI libraries. If one is lucky,
the GUI library will accept any screen coordinate -- but it is just as
likely that the OS could limit a program to only coordinates within its
own window.
Maybe the easiest way is to create a screenshot of the whole screen
(that should be doable from within a program, although this differs for every OS and GUI
lib as well) and then get the pixel value from that.

--irmen
Jun 29 '08 #2
cj*******@hotma il.com wrote:
>
Could anyone help me, I'm a python noob and need some help. im trying
to find some code that will, given a screen co-ordinate, will give me
the colour of that pixel in RGB. i have found a lot about getting the
pixel colour from a picture file with a given co-ordinate, but is it
possible to do it from the whole screen output regardless what
application the selected pixel is in?
Which operating system? If you are on Windows, and you have pywin32
loaded. you can use the Windows APIs GetDC and GetPixel.
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jun 30 '08 #3
On Jun 30, 4:37*am, Tim Roberts <t...@probo.com wrote:
cjstut...@hotma il.com wrote:
Could anyone help me, I'm a python noob and need some help. im trying
to find some code that will, given ascreenco-ordinate, will give me
thecolourof thatpixelin RGB. i have found a lot about getting the
pixelcolourfrom a picture file with a given co-ordinate, but is it
possible to do it from the wholescreenoutp ut regardless what
application the selectedpixelis in?

Which operating system? *If you are on Windows, and you have pywin32
loaded. you can use the Windows APIs GetDC and GetPixel.
--
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.
i have ubuntu hardy. does that help?
Jul 26 '08 #4
chris <cj*******@hotm ail.comwrote:
>On Jun 30, 4:37*am, Tim Roberts <t...@probo.com wrote:
>cjstut...@hotm ail.com wrote:
>Could anyone help me, I'm a python noob and need some help. im trying
to find some code that will, given ascreenco-ordinate, will give me
thecolourof thatpixelin RGB. i have found a lot about getting the
pixelcolourfro m a picture file with a given co-ordinate, but is it
possible to do it from the wholescreenoutp ut regardless what
application the selectedpixelis in?

Which operating system? *If you are on Windows, and you have pywin32
loaded. you can use the Windows APIs GetDC and GetPixel.

i have ubuntu hardy. does that help?
Then you will have to use a GUI library of some kind: wx, or Qt, or
tkinter. The answer depends on which GUI library you decide to use.
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jul 27 '08 #5

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

Similar topics

2
1922
by: Derek Scollon | last post by:
I'm using PHP4.2.2 with gd on a Linux platform and am having difficulty in solving a little problem despite going through the definitions of the various image functions. If you load a true-colour image from a file using... $image=imagecreatefrompng("file.png"); ....how do you then get the red, green and blue values of a pixel at $x, $y within that image? I'm sure it's fairly simple but I can't find this
4
8230
by: grogerteal | last post by:
Hello, I am pretty new to programming and would like someone to help me get started on the program that I need to make. I hope it is not hard to do, but what I would like is a simple app that has a label which returns the color of a pixel that is in position x,y on the screen (i.e. the desktop @ 1024 x 768 pixels), where x and y are of course variable.
3
2915
by: Mark Ingram | last post by:
Hi, ive got an imagine in a PictureBox, and would like to get the colour of the pixel when the mouse is over the control. From what ive (briefly) seen, there is no way to do this directly in C# and requires you to use GetPixel from the Win API? Is this correct? Any other better ways of doing this? Thanks,
6
4728
by: Hooyoo | last post by:
I want to get the color of the specified pixel in the screen. Firstly I get the position of the cursor: //Get the position of cursor. Point position = Cursor.Position; Next I want to get the color using the position of the cursor. Anybody here can show me some demo codes? Thanks.
20
3170
by: Chor Lit | last post by:
Hi, I asked Bjarne Stroustrup about the idea of adding colour standard for C++, and he said that it is very difficult for compiler vendors to change their IDE. But do you think it is possible ? Note that the proposed colour standard is not just merely to ease the eye only as what presently is in C++ compilers, but to aid in syntax disambiguation and other advantages. Here are a few advantages that I can think of:
4
3724
by: Johny | last post by:
I use PIL to write some text to a picture.The text must be seen wery clearly. I write the text to different pictures but to the same position. As pictures maybe different, colour, in the position where I write the text, is also different. Is there a way how to set the font colour so that it will be seen very clearly in the picture? For example, if the picture is bright ( for example yellow), the font colour should be dark( e.g. black)...
2
2093
by: kuratkull | last post by:
Hello, I haven't asked If I wasn't really confused :) OK, so I am just beginning SDL programming in C, and I was running fine, until I tried getting a pixel colour. Basically, I am trying to run the code from this page: http://www.libsdl.org/cgi/docwiki.cgi/Pixel_20Access This is the cut down version of my code:
8
1435
by: =?Utf-8?B?S2Vsdmlu?= | last post by:
Hi all, I am writing an application to detect the dead pixel of LCD panel by using visual C++ (MFC). My flow is follow: 1. Display a dialog with a start button. When the user press the start button. The whole screen become black colour. 2. When the user press any key by keyboard. The whole screen changes to red then green, blue and white. 3. The screen back to "normal display".
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10164
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...
0
9961
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8989
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
7512
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
6745
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();...
1
4066
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
2894
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.