[Image-SIG] Patch for loading .tga files

Alexey Borzenkov snaury at gmail.com
Sat Feb 3 15:16:59 CET 2007


Hi everyone,

As a follow up I found a really small bug with loading .tga files
where loader didn't accept 1-bit depth black&white files. See the
patch below, but I've also appended it to patch at
http://snaury.googlepages.com/Imaging-1.1.6-df-tga.patch (which
requires http://snaury.googlepages.com/Imaging-1.1.6-df-bgr.patch)

P.S. I wonder why my previous two letters didn't get thru to the
mailing list... x_x

diff -druN Imaging-1.1.6-orig/PIL/TgaImagePlugin.py
Imaging-1.1.6/PIL/TgaImagePlugin.py
--- Imaging-1.1.6-orig/PIL/TgaImagePlugin.py	Sun Dec  3 14:37:15 2006
+++ Imaging-1.1.6/PIL/TgaImagePlugin.py	Sat Feb  3 17:10:04 2007
@@ -70,7 +70,7 @@
         # validate header fields
         if id != 0 or colormaptype not in (0, 1) or\
            self.size[0] <= 0 or self.size[1] <= 0 or\
-           depth not in (8, 16, 24, 32):
+           depth not in (1, 8, 16, 24, 32):
             raise SyntaxError, "not a TGA file"

         # image mode


More information about the Image-SIG mailing list