Fix PIL image save when both pitch and format are converted. Fixes issue #34 (DEPTH_SAVE).
Fix PIL image save when both pitch and format are converted. Fixes issue #34
(DEPTH_SAVE).


Index: pyglet/image/codecs/pil.py
===================================================================
--- pyglet/image/codecs/pil.py	(revision 674)
+++ pyglet/image/codecs/pil.py	(working copy)
@@ -55,11 +55,10 @@
             format = 'JPEG'
 
         image = image.image_data
-        image.pitch = -(image.width * len(image.format))
-
-        # Only save in RGB or RGBA formats.
         if image.format != 'RGB':
+            # Only save in RGB or RGBA formats.
             image.format = 'RGBA'
+        image.pitch = -(image.width * len(image.format))
 
         # Note: Don't try and use frombuffer(..); different versions of
         # PIL will orient the image differently.



git-svn-id: d4fdfcd4de20a449196f78acc655f735742cd30d@675 14d46d22-621c-0410-bb3d-6f67920f7d95

regular/pyglet-avbin-optimizations,regular/pyglet-avbin-optimizations,regular/pyglet-avbin-optimizations,regular/pyglet-avbin-optimizations