[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] convert() bug?



The png is attached.  Here is the code I'm using (just a simple example):

import pygame, sys
pygame.init()
screen = pygame.display.set_mode([640,480])
screen.fill([255, 255, 255])
my_ball = pygame.image.load("beach_ball.png") 
my_ball = my_ball.convert()                 
screen.blit(my_ball,[50, 50, 90, 90])                           
pygame.display.flip()
while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT: sys.exit()

This displays a beach ball image.
Oddly, the black is only a line at the bottom. If it was related to transparency, I would expect there to be black all around the ball
If I remove the line that uses convert(), the black line goes away.  I tried convert_alpha, and that works as well, but the black line still puzzles me,

hwg


----- Original Message ----
From: Ethan Glasser-Camp <glasse@xxxxxxxxxx>
To: pygame-users@xxxxxxxx
Sent: Monday, December 17, 2007 4:50:02 PM
Subject: Re: [pygame] convert() bug?

> When I use convert() on a png file, the image displays with a 1-pixel
> wide black line across the bottom of the image.  If i use the image
> without using convert(), the black line is not there.=20
>=20
> Has anyone seen this before or know what causes it?

Can you send the image? It sounds like there's a one-pixel thick line
along the bottom of the image which is fully transparent. Since
convert() removes transparency, the line becomes visible. If that is
the case, you could consider using convert_alpha() to preserve alpha
(and thus transparency on that one-pixel-thick line).

Ethan




Looking for last minute shopping deals? Find them fast with Yahoo! Search.

Attachment: beach_ball.png
Description: PNG image