From cf27e03dcd445998ae205a5c59747326a536e593 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Mon, 8 Aug 2016 07:36:34 -0700 Subject: [PATCH] Added return for J2k (and fpx) Load to return a pixel access object --- PIL/FpxImagePlugin.py | 2 +- PIL/Jpeg2KImagePlugin.py | 2 +- Tests/test_file_jpeg2k.py | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/PIL/FpxImagePlugin.py b/PIL/FpxImagePlugin.py index aefc57420..a4a9098a7 100644 --- a/PIL/FpxImagePlugin.py +++ b/PIL/FpxImagePlugin.py @@ -216,7 +216,7 @@ class FpxImageFile(ImageFile.ImageFile): self.fp = self.ole.openstream(self.stream[:2] + ["Subimage 0000 Data"]) - ImageFile.ImageFile.load(self) + return ImageFile.ImageFile.load(self) # # -------------------------------------------------------------------- diff --git a/PIL/Jpeg2KImagePlugin.py b/PIL/Jpeg2KImagePlugin.py index 02b1e53f5..d54ee0ca4 100644 --- a/PIL/Jpeg2KImagePlugin.py +++ b/PIL/Jpeg2KImagePlugin.py @@ -207,7 +207,7 @@ class Jpeg2KImageFile(ImageFile.ImageFile): t3 = (t[3][0], self.reduce, self.layers, t[3][3], t[3][4]) self.tile = [(t[0], (0, 0) + self.size, t[2], t3)] - ImageFile.ImageFile.load(self) + return ImageFile.ImageFile.load(self) def _accept(prefix): diff --git a/Tests/test_file_jpeg2k.py b/Tests/test_file_jpeg2k.py index 815215df7..29a6d5f73 100644 --- a/Tests/test_file_jpeg2k.py +++ b/Tests/test_file_jpeg2k.py @@ -34,7 +34,8 @@ class TestFileJpeg2k(PillowTestCase): self.assertRegexpMatches(Image.core.jp2klib_version, '\d+\.\d+\.\d+$') im = Image.open('Tests/images/test-card-lossless.jp2') - im.load() + px = im.load() + self.assertTrue(px) self.assertEqual(im.mode, 'RGB') self.assertEqual(im.size, (640, 480)) self.assertEqual(im.format, 'JPEG2000')