473,396 Members | 1,608 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,396 software developers and data experts.

PIL 1.1.4 paste PNG's with transparency problem

Here's hoping effbot is around :)

I have a really simple situation where I have 2 png images, and open them
so:

'>>> iconBallImage =
Image.open('sampleTextures/iconBall.png').resize(DimensionSize)
'>>> iconShieldImage =
Image.open('sampleTextures/iconShield.png').resize(DimensionSize)

The 2nd image has an alpha channel with transparency. The first one also
has an alpha channel, but is fully opaque. Then I paste the second image
into the first image:

'>>> iconBallImage.paste(iconShieldImage, (10,10))

Then I save:

'>>> iconBallImage.save('sampleTextures/output.png')

When I view "output.png" in the Gimp, I see that the transparent bits in
the second image appear as a grey-crosshatching pattern. There is an
alpha channel in the new image, but I expected to see that bits of the
original first image would peer through the transparent bits of the
original second image.

I fully expect I am doing something wrong here, I just don't know what.

Thanks
Caleb
Jul 18 '05 #1
2 6211
"Caleb Hattingh" <ca****@telkomsa.net> wrote in message news:<op**************@news.telkomsa.net>...
iconBallImage.paste(iconShieldImage, (10,10)) iconBallImage.paste(iconShieldImage, (10,10), iconShieldImage)

^^^^^^^^^^^^^^^
transparency as 3rd parameter

TTFN
Tom.
Jul 18 '05 #2
Wow, that was pretty clueless of me...right there on the *next* page of
the manual (I thought "im.paste(image, box)" and "im.paste(image, color)"
were the general forms for "paste", apparently didn't look further)

thx
Caleb

On 29 Nov 2004 22:17:36 -0800, Tom Hanks <ga****************@hotmail.com>
wrote:
"Caleb Hattingh" <ca****@telkomsa.net> wrote in message
news:<op**************@news.telkomsa.net>...
>>> iconBallImage.paste(iconShieldImage, (10,10)) iconBallImage.paste(iconShieldImage, (10,10), iconShieldImage)

^^^^^^^^^^^^^^^
transparency as 3rd
parameter

TTFN
Tom.


Jul 18 '05 #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...
14
by: eastcoastguyz | last post by:
As I am learning PHP and seeing examples of handling graphics using the imagecreate functions. The few examples I have run across use PNG as the graphic file format of choice. Is there a reason for...
4
by: R.Marquez | last post by:
I am trying to create a simple script that Opens an existing PNG and resaves it with a transparent color. With the command line version of ImageMagic this is an easy endevor (and my current...
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?
2
by: Robin Becker | last post by:
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. For the png images of interest...
2
XedinUnknown
by: XedinUnknown | last post by:
Hi! I am new to this forum, but not new to web design and programming. Nevertheless, I have never tried to use PNG so extensively in my pages. here's the problem. First, I have found that the...
0
by: Durand | last post by:
Hi! I'm trying to paste a png with a transparent layer into an image using "image.paste(tesla,(20,10), tesla)" but I'm getting this error: ValueError: bad transparency mask I have used...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...
0
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...
0
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...
0
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,...

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.