mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 01:47:47 +03:00 
			
		
		
		
	Merge pull request #3333 from jdufresne/debug-print
Clean up commented out debug print statements
This commit is contained in:
		
						commit
						73c305d4d5
					
				| 
						 | 
					@ -52,10 +52,5 @@ for i0 in range(65556):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
print()
 | 
					print()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# print(check(min_size, min_start))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
print("#define ACCESS_TABLE_SIZE", min_size)
 | 
					print("#define ACCESS_TABLE_SIZE", min_size)
 | 
				
			||||||
print("#define ACCESS_TABLE_HASH", min_start)
 | 
					print("#define ACCESS_TABLE_HASH", min_start)
 | 
				
			||||||
 | 
					 | 
				
			||||||
# for m in modes:
 | 
					 | 
				
			||||||
#     print(m, "=>", hash(m, min_start) % min_size)
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -22,7 +22,6 @@ class TestBmpReference(PillowTestCase):
 | 
				
			||||||
                im.load()
 | 
					                im.load()
 | 
				
			||||||
            except Exception:  # as msg:
 | 
					            except Exception:  # as msg:
 | 
				
			||||||
                pass
 | 
					                pass
 | 
				
			||||||
                # print("Bad Image %s: %s" %(f,msg))
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_questionable(self):
 | 
					    def test_questionable(self):
 | 
				
			||||||
        """ These shouldn't crash/dos, but it's not well defined that these
 | 
					        """ These shouldn't crash/dos, but it's not well defined that these
 | 
				
			||||||
| 
						 | 
					@ -47,7 +46,6 @@ class TestBmpReference(PillowTestCase):
 | 
				
			||||||
            except Exception:  # as msg:
 | 
					            except Exception:  # as msg:
 | 
				
			||||||
                if os.path.basename(f) in supported:
 | 
					                if os.path.basename(f) in supported:
 | 
				
			||||||
                    raise
 | 
					                    raise
 | 
				
			||||||
                # print("Bad Image %s: %s" %(f,msg))
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_good(self):
 | 
					    def test_good(self):
 | 
				
			||||||
        """ These should all work. There's a set of target files in the
 | 
					        """ These should all work. There's a set of target files in the
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -47,10 +47,6 @@ class TestFormatHSV(PillowTestCase):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        img = Image.merge('RGB', (r, g, b))
 | 
					        img = Image.merge('RGB', (r, g, b))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # print(("%d, %d -> "% (int(1.75*px),int(.25*px))) + \
 | 
					 | 
				
			||||||
        #        "(%s, %s, %s)"%img.getpixel((1.75*px, .25*px)))
 | 
					 | 
				
			||||||
        # print(("%d, %d -> "% (int(.75*px),int(.25*px))) + \
 | 
					 | 
				
			||||||
        #        "(%s, %s, %s)"%img.getpixel((.75*px, .25*px)))
 | 
					 | 
				
			||||||
        return img
 | 
					        return img
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def to_xxx_colorsys(self, im, func, mode):
 | 
					    def to_xxx_colorsys(self, im, func, mode):
 | 
				
			||||||
| 
						 | 
					@ -95,15 +91,6 @@ class TestFormatHSV(PillowTestCase):
 | 
				
			||||||
        im = src.convert('HSV')
 | 
					        im = src.convert('HSV')
 | 
				
			||||||
        comparable = self.to_hsv_colorsys(src)
 | 
					        comparable = self.to_hsv_colorsys(src)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # print(im.getpixel((448, 64)))
 | 
					 | 
				
			||||||
        # print(comparable.getpixel((448, 64)))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        # print(im.split()[0].histogram())
 | 
					 | 
				
			||||||
        # print(comparable.split()[0].histogram())
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        # im.split()[0].show()
 | 
					 | 
				
			||||||
        # comparable.split()[0].show()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        self.assert_image_similar(im.getchannel(0), comparable.getchannel(0),
 | 
					        self.assert_image_similar(im.getchannel(0), comparable.getchannel(0),
 | 
				
			||||||
                                  1, "Hue conversion is wrong")
 | 
					                                  1, "Hue conversion is wrong")
 | 
				
			||||||
        self.assert_image_similar(im.getchannel(1), comparable.getchannel(1),
 | 
					        self.assert_image_similar(im.getchannel(1), comparable.getchannel(1),
 | 
				
			||||||
| 
						 | 
					@ -111,16 +98,9 @@ class TestFormatHSV(PillowTestCase):
 | 
				
			||||||
        self.assert_image_similar(im.getchannel(2), comparable.getchannel(2),
 | 
					        self.assert_image_similar(im.getchannel(2), comparable.getchannel(2),
 | 
				
			||||||
                                  1, "Value conversion is wrong")
 | 
					                                  1, "Value conversion is wrong")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # print(im.getpixel((192, 64)))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        comparable = src
 | 
					        comparable = src
 | 
				
			||||||
        im = im.convert('RGB')
 | 
					        im = im.convert('RGB')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # im.split()[0].show()
 | 
					 | 
				
			||||||
        # comparable.split()[0].show()
 | 
					 | 
				
			||||||
        # print(im.getpixel((192, 64)))
 | 
					 | 
				
			||||||
        # print(comparable.getpixel((192, 64)))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        self.assert_image_similar(im.getchannel(0), comparable.getchannel(0),
 | 
					        self.assert_image_similar(im.getchannel(0), comparable.getchannel(0),
 | 
				
			||||||
                                  3, "R conversion is wrong")
 | 
					                                  3, "R conversion is wrong")
 | 
				
			||||||
        self.assert_image_similar(im.getchannel(1), comparable.getchannel(1),
 | 
					        self.assert_image_similar(im.getchannel(1), comparable.getchannel(1),
 | 
				
			||||||
| 
						 | 
					@ -132,12 +112,6 @@ class TestFormatHSV(PillowTestCase):
 | 
				
			||||||
        im = hopper('RGB').convert('HSV')
 | 
					        im = hopper('RGB').convert('HSV')
 | 
				
			||||||
        comparable = self.to_hsv_colorsys(hopper('RGB'))
 | 
					        comparable = self.to_hsv_colorsys(hopper('RGB'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#        print([ord(x) for x  in im.split()[0].tobytes()[:80]])
 | 
					 | 
				
			||||||
#        print([ord(x) for x  in comparable.split()[0].tobytes()[:80]])
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#        print(im.split()[0].histogram())
 | 
					 | 
				
			||||||
#        print(comparable.split()[0].histogram())
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        self.assert_image_similar(im.getchannel(0), comparable.getchannel(0),
 | 
					        self.assert_image_similar(im.getchannel(0), comparable.getchannel(0),
 | 
				
			||||||
                                  1, "Hue conversion is wrong")
 | 
					                                  1, "Hue conversion is wrong")
 | 
				
			||||||
        self.assert_image_similar(im.getchannel(1), comparable.getchannel(1),
 | 
					        self.assert_image_similar(im.getchannel(1), comparable.getchannel(1),
 | 
				
			||||||
| 
						 | 
					@ -150,12 +124,6 @@ class TestFormatHSV(PillowTestCase):
 | 
				
			||||||
        converted = comparable.convert('RGB')
 | 
					        converted = comparable.convert('RGB')
 | 
				
			||||||
        comparable = self.to_rgb_colorsys(comparable)
 | 
					        comparable = self.to_rgb_colorsys(comparable)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # print(converted.split()[1].histogram())
 | 
					 | 
				
			||||||
        # print(target.split()[1].histogram())
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        # print([ord(x) for x  in target.split()[1].tobytes()[:80]])
 | 
					 | 
				
			||||||
        # print([ord(x) for x  in converted.split()[1].tobytes()[:80]])
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        self.assert_image_similar(converted.getchannel(0),
 | 
					        self.assert_image_similar(converted.getchannel(0),
 | 
				
			||||||
                                  comparable.getchannel(0),
 | 
					                                  comparable.getchannel(0),
 | 
				
			||||||
                                  3, "R conversion is wrong")
 | 
					                                  3, "R conversion is wrong")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -352,10 +352,8 @@ class CoreResamplePassesTest(PillowTestCase):
 | 
				
			||||||
class CoreResampleCoefficientsTest(PillowTestCase):
 | 
					class CoreResampleCoefficientsTest(PillowTestCase):
 | 
				
			||||||
    def test_reduce(self):
 | 
					    def test_reduce(self):
 | 
				
			||||||
        test_color = 254
 | 
					        test_color = 254
 | 
				
			||||||
        # print()
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for size in range(400000, 400010, 2):
 | 
					        for size in range(400000, 400010, 2):
 | 
				
			||||||
            # print(size)
 | 
					 | 
				
			||||||
            i = Image.new('L', (size, 1), 0)
 | 
					            i = Image.new('L', (size, 1), 0)
 | 
				
			||||||
            draw = ImageDraw.Draw(i)
 | 
					            draw = ImageDraw.Draw(i)
 | 
				
			||||||
            draw.rectangle((0, 0, i.size[0] // 2 - 1, 0), test_color)
 | 
					            draw.rectangle((0, 0, i.size[0] // 2 - 1, 0), test_color)
 | 
				
			||||||
| 
						 | 
					@ -363,7 +361,6 @@ class CoreResampleCoefficientsTest(PillowTestCase):
 | 
				
			||||||
            px = i.resize((5, i.size[1]), Image.BICUBIC).load()
 | 
					            px = i.resize((5, i.size[1]), Image.BICUBIC).load()
 | 
				
			||||||
            if px[2, 0] != test_color // 2:
 | 
					            if px[2, 0] != test_color // 2:
 | 
				
			||||||
                self.assertEqual(test_color // 2, px[2, 0])
 | 
					                self.assertEqual(test_color // 2, px[2, 0])
 | 
				
			||||||
                # print('>', size, test_color // 2, px[2, 0])
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_nonzero_coefficients(self):
 | 
					    def test_nonzero_coefficients(self):
 | 
				
			||||||
        # regression test for the wrong coefficients calculation
 | 
					        # regression test for the wrong coefficients calculation
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -96,7 +96,6 @@ if sys.platform.startswith('win32'):
 | 
				
			||||||
            hdr.biClrImportant = 0
 | 
					            hdr.biClrImportant = 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            hdc = CreateCompatibleDC(None)
 | 
					            hdc = CreateCompatibleDC(None)
 | 
				
			||||||
            # print('hdc:',hex(hdc))
 | 
					 | 
				
			||||||
            pixels = ctypes.c_void_p()
 | 
					            pixels = ctypes.c_void_p()
 | 
				
			||||||
            dib = CreateDIBSection(hdc, ctypes.byref(hdr), DIB_RGB_COLORS,
 | 
					            dib = CreateDIBSection(hdc, ctypes.byref(hdr), DIB_RGB_COLORS,
 | 
				
			||||||
                                   ctypes.byref(pixels), None, 0)
 | 
					                                   ctypes.byref(pixels), None, 0)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,7 +34,6 @@ class TestNumpy(PillowTestCase):
 | 
				
			||||||
                i = Image.fromarray(a)
 | 
					                i = Image.fromarray(a)
 | 
				
			||||||
                if list(i.getchannel(0).getdata()) != list(range(100)):
 | 
					                if list(i.getchannel(0).getdata()) != list(range(100)):
 | 
				
			||||||
                    print("data mismatch for", dtype)
 | 
					                    print("data mismatch for", dtype)
 | 
				
			||||||
            # print(dtype, list(i.getdata()))
 | 
					 | 
				
			||||||
            return i
 | 
					            return i
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Check supported 1-bit integer formats
 | 
					        # Check supported 1-bit integer formats
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -110,20 +110,6 @@ class BdfFontFile(FontFile.FontFile):
 | 
				
			||||||
                if s.find(b"LogicalFontDescription") < 0:
 | 
					                if s.find(b"LogicalFontDescription") < 0:
 | 
				
			||||||
                    comments.append(s[i+1:-1].decode('ascii'))
 | 
					                    comments.append(s[i+1:-1].decode('ascii'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # font = props["FONT"].split("-")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        # font[4] = bdf_slant[font[4].upper()]
 | 
					 | 
				
			||||||
        # font[11] = bdf_spacing[font[11].upper()]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        # ascent = int(props["FONT_ASCENT"])
 | 
					 | 
				
			||||||
        # descent = int(props["FONT_DESCENT"])
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        # fontname = ";".join(font[1:])
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        # print("#", fontname)
 | 
					 | 
				
			||||||
        # for i in comments:
 | 
					 | 
				
			||||||
        #       print("#", i)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        while True:
 | 
					        while True:
 | 
				
			||||||
            c = bdf_char(fp)
 | 
					            c = bdf_char(fp)
 | 
				
			||||||
            if not c:
 | 
					            if not c:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -56,14 +56,6 @@ class CurImageFile(BmpImagePlugin.BmpImageFile):
 | 
				
			||||||
                m = s
 | 
					                m = s
 | 
				
			||||||
            elif i8(s[0]) > i8(m[0]) and i8(s[1]) > i8(m[1]):
 | 
					            elif i8(s[0]) > i8(m[0]) and i8(s[1]) > i8(m[1]):
 | 
				
			||||||
                m = s
 | 
					                m = s
 | 
				
			||||||
            # print("width", i8(s[0]))
 | 
					 | 
				
			||||||
            # print("height", i8(s[1]))
 | 
					 | 
				
			||||||
            # print("colors", i8(s[2]))
 | 
					 | 
				
			||||||
            # print("reserved", i8(s[3]))
 | 
					 | 
				
			||||||
            # print("hotspot x", i16(s[4:]))
 | 
					 | 
				
			||||||
            # print("hotspot y", i16(s[6:]))
 | 
					 | 
				
			||||||
            # print("bytes", i32(s[8:]))
 | 
					 | 
				
			||||||
            # print("offset", i32(s[12:]))
 | 
					 | 
				
			||||||
        if not m:
 | 
					        if not m:
 | 
				
			||||||
            raise TypeError("No cursors were found")
 | 
					            raise TypeError("No cursors were found")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -82,7 +82,6 @@ def Ghostscript(tile, size, fp, scale=1):
 | 
				
			||||||
    # resolution is dependent on bbox and size
 | 
					    # resolution is dependent on bbox and size
 | 
				
			||||||
    res = (float((72.0 * size[0]) / (bbox[2]-bbox[0])),
 | 
					    res = (float((72.0 * size[0]) / (bbox[2]-bbox[0])),
 | 
				
			||||||
           float((72.0 * size[1]) / (bbox[3]-bbox[1])))
 | 
					           float((72.0 * size[1]) / (bbox[3]-bbox[1])))
 | 
				
			||||||
    # print("Ghostscript", scale, size, orig_size, bbox, orig_bbox, res)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    import subprocess
 | 
					    import subprocess
 | 
				
			||||||
    import tempfile
 | 
					    import tempfile
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -90,7 +90,6 @@ class FontFile(object):
 | 
				
			||||||
                    x = xx
 | 
					                    x = xx
 | 
				
			||||||
                s = src[0] + x0, src[1] + y0, src[2] + x0, src[3] + y0
 | 
					                s = src[0] + x0, src[1] + y0, src[2] + x0, src[3] + y0
 | 
				
			||||||
                self.bitmap.paste(im.crop(src), s)
 | 
					                self.bitmap.paste(im.crop(src), s)
 | 
				
			||||||
                # print(chr(i), dst, s)
 | 
					 | 
				
			||||||
                self.metrics[i] = d, dst, s
 | 
					                self.metrics[i] = d, dst, s
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def save(self, filename):
 | 
					    def save(self, filename):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -114,8 +114,6 @@ class FpxImageFile(ImageFile.ImageFile):
 | 
				
			||||||
            if id in prop:
 | 
					            if id in prop:
 | 
				
			||||||
                self.jpeg[i] = prop[id]
 | 
					                self.jpeg[i] = prop[id]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # print(len(self.jpeg), "tables loaded")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        self._open_subimage(1, self.maxid)
 | 
					        self._open_subimage(1, self.maxid)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _open_subimage(self, index=1, subimage=0):
 | 
					    def _open_subimage(self, index=1, subimage=0):
 | 
				
			||||||
| 
						 | 
					@ -143,8 +141,6 @@ class FpxImageFile(ImageFile.ImageFile):
 | 
				
			||||||
        offset = i32(s, 28)
 | 
					        offset = i32(s, 28)
 | 
				
			||||||
        length = i32(s, 32)
 | 
					        length = i32(s, 32)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # print(size, self.mode, self.rawmode)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if size != self.size:
 | 
					        if size != self.size:
 | 
				
			||||||
            raise IOError("subimage mismatch")
 | 
					            raise IOError("subimage mismatch")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -443,7 +443,6 @@ def _getdecoder(mode, decoder_name, args, extra=()):
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        # get decoder
 | 
					        # get decoder
 | 
				
			||||||
        decoder = getattr(core, decoder_name + "_decoder")
 | 
					        decoder = getattr(core, decoder_name + "_decoder")
 | 
				
			||||||
        # print(decoder, mode, args + extra)
 | 
					 | 
				
			||||||
        return decoder(mode, *args + extra)
 | 
					        return decoder(mode, *args + extra)
 | 
				
			||||||
    except AttributeError:
 | 
					    except AttributeError:
 | 
				
			||||||
        raise IOError("decoder %s not available" % decoder_name)
 | 
					        raise IOError("decoder %s not available" % decoder_name)
 | 
				
			||||||
| 
						 | 
					@ -465,7 +464,6 @@ def _getencoder(mode, encoder_name, args, extra=()):
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        # get encoder
 | 
					        # get encoder
 | 
				
			||||||
        encoder = getattr(core, encoder_name + "_encoder")
 | 
					        encoder = getattr(core, encoder_name + "_encoder")
 | 
				
			||||||
        # print(encoder, mode, args + extra)
 | 
					 | 
				
			||||||
        return encoder(mode, *args + extra)
 | 
					        return encoder(mode, *args + extra)
 | 
				
			||||||
    except AttributeError:
 | 
					    except AttributeError:
 | 
				
			||||||
        raise IOError("encoder %s not available" % encoder_name)
 | 
					        raise IOError("encoder %s not available" % encoder_name)
 | 
				
			||||||
| 
						 | 
					@ -2470,7 +2468,6 @@ def fromarray(obj, mode=None):
 | 
				
			||||||
            typekey = (1, 1) + shape[2:], arr['typestr']
 | 
					            typekey = (1, 1) + shape[2:], arr['typestr']
 | 
				
			||||||
            mode, rawmode = _fromarray_typemap[typekey]
 | 
					            mode, rawmode = _fromarray_typemap[typekey]
 | 
				
			||||||
        except KeyError:
 | 
					        except KeyError:
 | 
				
			||||||
            # print(typekey)
 | 
					 | 
				
			||||||
            raise TypeError("Cannot handle this data type")
 | 
					            raise TypeError("Cannot handle this data type")
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        rawmode = mode
 | 
					        rawmode = mode
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -151,11 +151,6 @@ class LutBuilder(object):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            patterns += self._pattern_permute(pattern, options, result)
 | 
					            patterns += self._pattern_permute(pattern, options, result)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#        # Debugging
 | 
					 | 
				
			||||||
#        for p, r in patterns:
 | 
					 | 
				
			||||||
#            print(p, r)
 | 
					 | 
				
			||||||
#        print('--')
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        # compile the patterns into regular expressions for speed
 | 
					        # compile the patterns into regular expressions for speed
 | 
				
			||||||
        for i, pattern in enumerate(patterns):
 | 
					        for i, pattern in enumerate(patterns):
 | 
				
			||||||
            p = pattern[0].replace('.', 'X').replace('X', '[01]')
 | 
					            p = pattern[0].replace('.', 'X').replace('X', '[01]')
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -103,8 +103,6 @@ class IptcImageFile(ImageFile.ImageFile):
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                self.info[tag] = tagdata
 | 
					                self.info[tag] = tagdata
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            # print(tag, self.info[tag])
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        # mode
 | 
					        # mode
 | 
				
			||||||
        layers = i8(self.info[(3, 60)][0])
 | 
					        layers = i8(self.info[(3, 60)][0])
 | 
				
			||||||
        component = i8(self.info[(3, 60)][1])
 | 
					        component = i8(self.info[(3, 60)][1])
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -334,7 +334,6 @@ class JpegImageFile(ImageFile.ImageFile):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if i in MARKER:
 | 
					            if i in MARKER:
 | 
				
			||||||
                name, description, handler = MARKER[i]
 | 
					                name, description, handler = MARKER[i]
 | 
				
			||||||
                # print(hex(i), name, description)
 | 
					 | 
				
			||||||
                if handler is not None:
 | 
					                if handler is not None:
 | 
				
			||||||
                    handler(self, i)
 | 
					                    handler(self, i)
 | 
				
			||||||
                if i == 0xFFDA:  # start of scan
 | 
					                if i == 0xFFDA:  # start of scan
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -74,7 +74,6 @@ def isSpiderHeader(t):
 | 
				
			||||||
    labrec = int(h[13])   # no. records in file header
 | 
					    labrec = int(h[13])   # no. records in file header
 | 
				
			||||||
    labbyt = int(h[22])   # total no. of bytes in header
 | 
					    labbyt = int(h[22])   # total no. of bytes in header
 | 
				
			||||||
    lenbyt = int(h[23])   # record length in bytes
 | 
					    lenbyt = int(h[23])   # record length in bytes
 | 
				
			||||||
    # print("labrec = %d, labbyt = %d, lenbyt = %d" % (labrec,labbyt,lenbyt))
 | 
					 | 
				
			||||||
    if labbyt != (labrec * lenbyt):
 | 
					    if labbyt != (labrec * lenbyt):
 | 
				
			||||||
        return 0
 | 
					        return 0
 | 
				
			||||||
    # looks like a valid header
 | 
					    # looks like a valid header
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1265,9 +1265,6 @@ class TiffImageFile(ImageFile.ImageFile):
 | 
				
			||||||
            h = self.tag_v2.get(ROWSPERSTRIP, ysize)
 | 
					            h = self.tag_v2.get(ROWSPERSTRIP, ysize)
 | 
				
			||||||
            w = self.size[0]
 | 
					            w = self.size[0]
 | 
				
			||||||
            if READ_LIBTIFF or self._compression != 'raw':
 | 
					            if READ_LIBTIFF or self._compression != 'raw':
 | 
				
			||||||
                # if DEBUG:
 | 
					 | 
				
			||||||
                #     print("Activating g4 compression for whole file")
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                # Decoder expects entire file as one tile.
 | 
					                # Decoder expects entire file as one tile.
 | 
				
			||||||
                # There's a buffer size limit in load (64k)
 | 
					                # There's a buffer size limit in load (64k)
 | 
				
			||||||
                # so large g4 images will fail if we use that
 | 
					                # so large g4 images will fail if we use that
 | 
				
			||||||
| 
						 | 
					@ -1540,7 +1537,6 @@ def _save(im, fp, filename):
 | 
				
			||||||
            rawmode = 'I;16N'
 | 
					            rawmode = 'I;16N'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        a = (rawmode, compression, _fp, filename, atts)
 | 
					        a = (rawmode, compression, _fp, filename, atts)
 | 
				
			||||||
        # print(im.mode, compression, a, im.encoderconfig)
 | 
					 | 
				
			||||||
        e = Image._getencoder(im.mode, 'libtiff', a, im.encoderconfig)
 | 
					        e = Image._getencoder(im.mode, 'libtiff', a, im.encoderconfig)
 | 
				
			||||||
        e.setimage(im.im, (0, 0)+im.size)
 | 
					        e.setimage(im.im, (0, 0)+im.size)
 | 
				
			||||||
        while True:
 | 
					        while True:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -109,8 +109,6 @@ class WmfStubImageFile(ImageFile.StubImageFile):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            self.info["dpi"] = 72
 | 
					            self.info["dpi"] = 72
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            # print(self.mode, self.size, self.info)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            # sanity check (standard metafile header)
 | 
					            # sanity check (standard metafile header)
 | 
				
			||||||
            if s[22:26] != b"\x01\x00\t\x00":
 | 
					            if s[22:26] != b"\x01\x00\t\x00":
 | 
				
			||||||
                raise SyntaxError("Unsupported WMF file format")
 | 
					                raise SyntaxError("Unsupported WMF file format")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user