Here's the image and code:

 

def load_alpha_image(name):
    fullname = os.path.join('Images', name)
    try:
        image = pygame.image.load(fullname).convert_alpha()
    except pygame.error, message:
        print 'Cannot load image:', fullname
        raise SystemExit, message
    return image


 


Date: Wed, 10 Jun 2009 15:56:10 -0700
Subject: Re: [pygame] Alpha channels and per pixel alpha
From: br...@hamsterrepublic.com
To: pygame-users@seul.org

It would help to see your code and have an example image attached, cause 
loading .png's with alpha and blitting with transparency works fine for me 
without any trouble or special stuff.


On Wed, Jun 10, 2009 at 2:11 PM, Bjorn Samuelsson <bjorn_...@hotmail.com> wrote:


Hey all,
 
I'm trying to make a small 2d game and I'm wondering how you would go about to 
load a png-image with an alpha channel and keep it's alpha values?
I have confirmed the images alpha channel but when i load it in pygame it's 
alpha values are always 255.
I've tried Surface.convert_alpha but that doesn't make a difference.
At the moment I've resorted to saving my alpha channels separate and loading 
both image and alpha channel so that i can call Surface.set_at to change the 
image's per pixel alpha value.
But that solution seems less than optimal so i figured i would ask you guys.
 
regards
Björn
 
ps. I apologize if this topic has been discussed at length already but i've 
been looking around and i just can't seem to find a simple solution. ds.



Invite your mail contacts to join your friends list with Windows Live Spaces. 
It's easy! Try it!

_________________________________________________________________
Windows Live™: Keep your life in sync. Check it out!
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_allup_explore_012009

<<attachment: default_alpha2.png>>

Reply via email to