473,385 Members | 2,069 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,385 software developers and data experts.

png transparency with PIL

I'm trying to determine the transparency information for a png image. With gif
images I can determine the colour that is used for transparent areas using
im.info['transparency']. For the png images of interest there is no such entry
in the info dict. I assume that's because of the way png does transparency. I'm
guessing I need the alpha channel, but is there a way to get hold of it?
--
Robin Becker

Nov 23 '07 #1
2 1795
Robin Becker wrote:
I'm trying to determine the transparency information for a png
image. With gif images I can determine the colour that is used for
transparent areas using im.info['transparency']. For the png
images of interest there is no such entry in the info dict. I
assume that's because of the way png does transparency. I'm
guessing I need the alpha channel, but is there a way to get hold
of it?
For accessing the alpha channel, there is an RGBA mode for PNG
files:

http://www.pythonware.com/library/pi...format-png.htm

Regards,
Björn

--
BOFH excuse #58:

high pressure system failure

Nov 23 '07 #2
Bjoern Schliessmann wrote:
Robin Becker wrote:
>I'm trying to determine the transparency information for a png
..........
>guessing I need the alpha channel, but is there a way to get hold
of it?

For accessing the alpha channel, there is an RGBA mode for PNG
files:

http://www.pythonware.com/library/pi...format-png.htm
........

that sounds like what I need.
--
Robin Becker
Nov 23 '07 #3

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

Similar topics

2
by: Cecile Muller | last post by:
I've been trying to just open a png and display it, that way: <? header ("Content-type: image/png"); $im = imagecreatefrompng('empty.png'); imagepng($im); ?> But the transparency is not...
57
by: Piotr Wolski | last post by:
how to make my page that it was correct with every browser standard? for example when i change HTML's table size it has no effect when i see it under mozilla and has effect under Internet...
4
by: Matthias Czapla | last post by:
Hi! I want to resize uploaded GIF images. Currently I do it like this: <?php // ... $img = imagecreatefromgif($path); $img_scaled = imagecreate($new_width, $new_height);...
2
by: Robin Becker | last post by:
Has anyone done transparency with PIL & TIFF? I'm using PIL to generate a preview TIFF for embedding into an eps file and am being asked for the TIFF to support transparency. -- Robin Becker
3
by: Mr. x | last post by:
Hello, I would like that my image's background color will be transparent. What I have is only paintbrush. My image is *.jpg format (I have tried to save it as *.gif format, and I got less...
20
by: Nathan Sokalski | last post by:
I am trying to create graphics with GDI+ that include transparency. However, the transparency never seems to show up, even though my colors have an alpha value of 0. How can I generate a graphic...
6
by: tommaso.gastaldi | last post by:
In a previous post I have been asking about a way to test Alpha Transparency. Bob and Michael have kindly provided some ideas. Here I would like to share the function I have prepared, for the...
0
by: ZikO | last post by:
Hi. I've experienced one problem. Im using three froms. Two of them are maximized, whereas one is normal form with transparency. Transparency stops working, that is I can see the color which...
1
by: dragze | last post by:
Hi, On one of the pages of my site i use two javascripts, one makes transparency of png's work in IE, and the other embeds a flash player. Now use one of the scripts it works fine, use both and...
3
by: Martijn Mulder | last post by:
When I populate a ToolStrip with ToolStripButtons with a .png-image on it, will Windows understand the transparency of the .png file?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...

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.