diff --git a/PIL/BmpImagePlugin.py b/PIL/BmpImagePlugin.py index e715d8583..e398445fa 100644 --- a/PIL/BmpImagePlugin.py +++ b/PIL/BmpImagePlugin.py @@ -130,9 +130,10 @@ class BmpImageFile(ImageFile.ImageFile): # ----------------- Process BMP with Bitfields compression (not palette) if file_info['compression'] == self.BITFIELDS: SUPPORTED = { - 32: [(0xff0000, 0xff00, 0xff, 0x0), (0xff0000, 0xff00, 0xff, 0xff000000), (0x0, 0x0, 0x0, 0x0)], - 24: [(0xff0000, 0xff00, 0xff)], - 16: [(0xf800, 0x7e0, 0x1f), (0x7c00, 0x3e0, 0x1f)]} + 32: [(0xff0000, 0xff00, 0xff, 0x0), (0xff0000, 0xff00, 0xff, 0xff000000), (0x0, 0x0, 0x0, 0x0)], + 24: [(0xff0000, 0xff00, 0xff)], + 16: [(0xf800, 0x7e0, 0x1f), (0x7c00, 0x3e0, 0x1f)] + } MASK_MODES = { (32, (0xff0000, 0xff00, 0xff, 0x0)): "BGRX", (32, (0xff0000, 0xff00, 0xff, 0xff000000)): "BGRA", diff --git a/PIL/JpegImagePlugin.py b/PIL/JpegImagePlugin.py index 12399ac4e..61a6af633 100644 --- a/PIL/JpegImagePlugin.py +++ b/PIL/JpegImagePlugin.py @@ -434,7 +434,7 @@ def _getexif(self): else: info = TiffImagePlugin.ImageFileDirectory_v1(head) info.load(file) - exif[0x8825] = dict([(k,v[0]) if len(v) == 1 else (k,v) for k,v in info.items()]) + exif[0x8825] = dict([(k, v[0]) if len(v) == 1 else (k, v) for k, v in info.items()]) return exif diff --git a/Tests/test_file_jpeg.py b/Tests/test_file_jpeg.py index 1591c1e83..6f144bfea 100644 --- a/Tests/test_file_jpeg.py +++ b/Tests/test_file_jpeg.py @@ -320,8 +320,8 @@ class TestFileJpeg(PillowTestCase): # dict of qtable lists self.assert_image_similar(im, self.roundtrip(im, qtables={ - 0: standard_l_qtable, - 1: standard_chrominance_qtable + 0: standard_l_qtable, + 1: standard_chrominance_qtable }), 30) # not a sequence diff --git a/Tests/test_file_libtiff.py b/Tests/test_file_libtiff.py index 838b59365..d18314271 100644 --- a/Tests/test_file_libtiff.py +++ b/Tests/test_file_libtiff.py @@ -170,7 +170,7 @@ class TestFileLibTiff(LibTiffTestCase): 'RowsPerStrip', 'StripOffsets'] for field in requested_fields: - self.assertTrue(field in reloaded, "%s not in metadata" %field) + self.assertTrue(field in reloaded, "%s not in metadata" % field) def test_g3_compression(self): i = Image.open('Tests/images/hopper_g4_500.tif') diff --git a/Tests/test_file_tiff.py b/Tests/test_file_tiff.py index 5c5958184..26b6bd4c3 100644 --- a/Tests/test_file_tiff.py +++ b/Tests/test_file_tiff.py @@ -113,7 +113,7 @@ class TestFileTiff(PillowTestCase): self.assert_warning(UserWarning, i._getexif) except struct.error: self.fail( - "Bad EXIF data passed incorrect values to _binary unpack") + "Bad EXIF data passed incorrect values to _binary unpack") def test_save_rgba(self): im = hopper("RGBA") @@ -245,18 +245,18 @@ class TestFileTiff(PillowTestCase): im = Image.open(filename) # v2 interface self.assertEqual( - im.tag_v2.as_dict(), - {256: 55, 257: 43, 258: (8, 8, 8, 8), 259: 1, - 262: 2, 296: 2, 273: (8,), 338: (1,), 277: 4, - 279: (9460,), 282: 72.0, 283: 72.0, 284: 1}) + im.tag_v2.as_dict(), + {256: 55, 257: 43, 258: (8, 8, 8, 8), 259: 1, + 262: 2, 296: 2, 273: (8,), 338: (1,), 277: 4, + 279: (9460,), 282: 72.0, 283: 72.0, 284: 1}) # legacy interface self.assertEqual( - im.tag.as_dict(), - {256: (55,), 257: (43,), 258: (8, 8, 8, 8), 259: (1,), - 262: (2,), 296: (2,), 273: (8,), 338: (1,), 277: (4,), - 279: (9460,), 282: ((720000, 10000),), - 283: ((720000, 10000),), 284: (1,)}) + im.tag.as_dict(), + {256: (55,), 257: (43,), 258: (8, 8, 8, 8), 259: (1,), + 262: (2,), 296: (2,), 273: (8,), 338: (1,), 277: (4,), + 279: (9460,), 282: ((720000, 10000),), + 283: ((720000, 10000),), 284: (1,)}) def test__delitem__(self): filename = "Tests/images/pil136.tiff" diff --git a/Tests/test_imagefont_bitmap.py b/Tests/test_imagefont_bitmap.py index 51da499b8..7ee5f8a2b 100644 --- a/Tests/test_imagefont_bitmap.py +++ b/Tests/test_imagefont_bitmap.py @@ -14,14 +14,16 @@ class TestImageFontBitmap(PillowTestCase): def test_similar(self): text = 'EmbeddedBitmap' font_outline = ImageFont.truetype( - font='Tests/fonts/DejaVuSans.ttf', size=24) + font='Tests/fonts/DejaVuSans.ttf', size=24) font_bitmap = ImageFont.truetype( - font='Tests/fonts/DejaVuSans-bitmap.ttf', size=24) - size_outline, size_bitmap = font_outline.getsize(text), font_bitmap.getsize(text) + font='Tests/fonts/DejaVuSans-bitmap.ttf', size=24) + size_outline = font_outline.getsize(text) + size_bitmap = font_bitmap.getsize(text) size_final = max(size_outline[0], size_bitmap[0]), max(size_outline[1], size_bitmap[1]) im_bitmap = Image.new('RGB', size_final, (255, 255, 255)) im_outline = im_bitmap.copy() - draw_bitmap, draw_outline = ImageDraw.Draw(im_bitmap), ImageDraw.Draw(im_outline) + draw_bitmap = ImageDraw.Draw(im_bitmap) + draw_outline = ImageDraw.Draw(im_outline) # Metrics are different on the bitmap and ttf fonts, # more so on some platforms and versions of freetype than others.