List Info

Thread: Patch for loading .tga files




Patch for loading .tga files
user name
2007-02-03 08:16:59
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
_______________________________________________
Image-SIG maillist  -  Image-SIGpython.org
htt
p://mail.python.org/mailman/listinfo/image-sig

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )