1. pygame
  2. pygame
  3. pygame
  4. Issues


Issue #13 resolved

pygame.image.save can't save in png format

René Dudfield
created an issue

== Nick Irvine, 2008-04-11 04:52:11 -0700

{{{ Created attachment 8 Bugfix patch

pygame.image.save doesn't save to the correct format. This code should demonstrate:

import pygame

original test file is a 320x240 88.7kB png file

im = pygame.image.load('/tmp/img0.png')

yields img1.png, 13.0kB jpeg file

pygame.image.save(im, '/tmp/img1.png')

yields img2.PNG, 191.5 kB TGA file

pygame.image.save(im, '/tmp/img2.PNG')

yields img3.tga, 191.5 kB TGA file

pygame.image.save(im, '/tmp/img3.tga')

yields img4/jpeg, 13.0 kB jpeg file

pygame.image.save(im, '/tmp/img4.jpeg')

end of script

I believe the problem lies in src/imageext.c, around line 450. I've attached a patch which I believe fixes the problem. }}}

Attachments: [[http://www.pygame.org/old_bug_attachments/8/imageext.c| imageext.c]]

== Nick Irvine, 2008-04-11 04:53:28 -0700

{{{ By the way, this is one of my first patches ever, so comments on the way I've submitted it are welcome. }}}

== Thorbrian, 2008-04-12 13:58:26 -0700

{{{ committed 1205

Nick, please confirm in that revision.

... as far as feedback on the patch goes - what you submitted is a patched file, which is not the same thing as a patch. Subversion can produce patches for you with the diff command.

Your test script was great, btw - turns out there was also a problem with saving .JPEG files (would save as TGA's) }}}

== Nick Irvine, 2008-04-13 02:13:53 -0700

{{{ I actually did create a diff, but attached the wrong file. D'oh! }}}

Comments (1)

  1. Log in to comment