473,287 Members | 1,827 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

What colour model does the image use in PIL

I use PIL and with it im.getpixel((x,y)) to find out the colour of a
pixel.
But how can I find out in which color model the the return value
is?

For example for png picture format

im.getpixel((20,50)) gives the result 60.

What does the value mean?
Is it possible to find out the RGB model values?

Thank you for help.
L.

Nov 7 '07 #1
3 1875
Johny <py****@hope.czwrites:
I use PIL and with it im.getpixel((x,y)) to find out the colour of a
pixel. But how can I find out in which color model the the return
value is?
im.mode gives you a string such as 'RGBA' or 'CMYK'. im.getbands()
returns a tuple such as ('R', 'G', 'B', 'A').
Nov 7 '07 #2
On Nov 7, 2:53 pm, Hrvoje Niksic <hnik...@xemacs.orgwrote:
Johny <pyt...@hope.czwrites:
I use PIL and with it im.getpixel((x,y)) to find out the colour of a
pixel. But how can I find out in which color model the the return
value is?

im.mode gives you a string such as 'RGBA' or 'CMYK'. im.getbands()
returns a tuple such as ('R', 'G', 'B', 'A').
Thank you for your help.
Can you please help me once more?
Now I would need to apply a threshold value to the image, where
everything above a certain brightness level becomes white, and
everything below the level becomes black.
How can I do that with PIL?
Thank you
L

Nov 7 '07 #3
Johny <py****@hope.czwrites:
I would need to apply a threshold value to the image, where
everything above a certain brightness level becomes white, and
everything below the level becomes black. How can I do that with
PIL?
I think you're supposed to use the "point" method, but I don't have an
example ready. See
http://mail.python.org/pipermail/ima...er/003019.html
for a hint.
Nov 7 '07 #4

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

Similar topics

4
by: Dj Frenzy | last post by:
Hi, I know how to use javascript to change a background image to another background image, and how to change a background colour to another background colour. Is there a way to change an image to a...
17
by: candy_init | last post by:
I sometimes comes across statements which invloves the use of size_t.But I dont know exactly that what is the meaning of size_t.What I know about it is that it is used to hide the platform...
2
by: bob | last post by:
Hello, I want to show progress to the user while some method is running so I thought I'd use a progress bar. But I don't see how I can do this without writing GUI code in the model? In...
3
by: Fuzzyman | last post by:
Hello all, I'm using a website creation tool (called `rest2web <http://www.voidspace.org.uk/python/rest2web/>`_) that lets me store my content in a text based format ( `ReStructuredText...
39
by: VidTheKid | last post by:
THE PROBLEM The % symbol is too vague when defining dimensions in CSS and HTML. It can relate to an inherited value, a measure of the containing element (which can differ between box models) or...
10
by: Pulzar | last post by:
Hi there, I want to show a simple image on a web page, and allow the viewer to select and change one of the colours used in the image, and immediately preview the result. I'd like to keep the...
6
by: Piyu | last post by:
Hi, I am working in jsp pages.in that i used background colour for heading through css.and those colours(heading, image background colour also) are not coming in printing. from my machine i...
2
by: Craig | last post by:
Hi there, I'm trying to open colour BMPs using PIL and I'm getting the following errors. Opening a 16 colour BMP I get: Traceback (most recent call last): File "<pyshell#3>", line 1, in...
7
by: simon2x1 | last post by:
I create a css that will make the text on my html page change colour when the mouse is on it but on the page when i roll over the mouse to an image that i link it also change colour how can i make...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.