Re: [pygame] convert() bug?
I load png and jpg on Linux mac and win with no problems so far. I assume every distro of pygame has image_ext in it, and that it provides a consistent level of format support across all platforms in the load function. I would say if you experience something that isn't consistent in that way, it should be reported as a bug. On Jan 1, 2008 10:02 AM, hwg [EMAIL PROTECTED] wrote: Thanks for the explanation. I have another, related question... What image formats are supported cross-platform (Windows, Linux, Mac) by default in Pygame, without using any other modules or external graphics aupport? Thanks, hwg - Original Message From: Brian Fisher [EMAIL PROTECTED] To: pygame-users@seul.org Sent: Friday, December 28, 2007 12:10:01 PM Subject: Re: [pygame] convert() bug? thanks for sending the example and file - it looks like Ethan was correct about what's going on. Most places where the image is transparent, it is transparent-white. The bottom line is transparent-black. You didn't notice the transparency being removed anywhere but the black line because in your example the background is white. This modified simple example should make all this clearer (magic pink background, multiple versions of beach ball image drawn): import pygame, sys pygame.init() screen = pygame.display.set_mode([640,480]) screen.fill([255, 0, 255]) my_ball_original = pygame.image.load(beach_ball.png) my_ball_convert = my_ball_original.convert() my_ball_convert_alpha = my_ball_original.convert_alpha() screen.blit(my_ball_original,[50, 50, 90, 90]) screen.blit(my_ball_convert,[150, 50, 90, 90]) screen.blit(my_ball_convert_alpha,[250, 50, 90, 90]) my_ball_remove_column_alpha = my_ball_original.convert_alpha() for y in xrange(my_ball_remove_column_alpha.get_height()): pos = (0, y) pixel = my_ball_remove_column_alpha.get_at(pos) pixel = (pixel[0], pixel[1], pixel[2], 255) my_ball_remove_column_alpha.set_at(pos, pixel) screen.blit(my_ball_remove_column_alpha,[350, 50, 90, 90]) pygame.display.flip() while True: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() On Dec 28, 2007 7:10 AM, hwg [EMAIL PROTECTED] wrote: 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 [EMAIL PROTECTED] To: pygame-users@seul.org Sent: Monday, December 17, 2007 4:50:02 PM Subject: Re: [pygame] convert() bug? 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 Never miss a thing. Make Yahoo your homepage.
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 [EMAIL PROTECTED] To: pygame-users@seul.org 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 Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ attachment: beach_ball.png
Re: [pygame] convert() bug?
thanks for sending the example and file - it looks like Ethan was correct about what's going on. Most places where the image is transparent, it is transparent-white. The bottom line is transparent-black. You didn't notice the transparency being removed anywhere but the black line because in your example the background is white. This modified simple example should make all this clearer (magic pink background, multiple versions of beach ball image drawn): import pygame, sys pygame.init() screen = pygame.display.set_mode([640,480]) screen.fill([255, 0, 255]) my_ball_original = pygame.image.load(beach_ball.png) my_ball_convert = my_ball_original.convert() my_ball_convert_alpha = my_ball_original.convert_alpha() screen.blit(my_ball_original,[50, 50, 90, 90]) screen.blit(my_ball_convert,[150, 50, 90, 90]) screen.blit(my_ball_convert_alpha,[250, 50, 90, 90]) my_ball_remove_column_alpha = my_ball_original.convert_alpha() for y in xrange(my_ball_remove_column_alpha.get_height()): pos = (0, y) pixel = my_ball_remove_column_alpha.get_at(pos) pixel = (pixel[0], pixel[1], pixel[2], 255) my_ball_remove_column_alpha.set_at(pos, pixel) screen.blit(my_ball_remove_column_alpha,[350, 50, 90, 90]) pygame.display.flip() while True: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() On Dec 28, 2007 7:10 AM, hwg [EMAIL PROTECTED] wrote: 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 [EMAIL PROTECTED] To: pygame-users@seul.org Sent: Monday, December 17, 2007 4:50:02 PM Subject: Re: [pygame] convert() bug? 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
[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. Has anyone seen this before or know what causes it? Thanks, hwg Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
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 signature.asc Description: OpenPGP digital signature