diff --git a/PIL/EpsImagePlugin.py b/PIL/EpsImagePlugin.py index 6f22308de..08110abf3 100644 --- a/PIL/EpsImagePlugin.py +++ b/PIL/EpsImagePlugin.py @@ -129,6 +129,7 @@ def Ghostscript(tile, size, fp, scale=1): "-c", "%d %d translate" % (-bbox[0], -bbox[1]), # adjust for image origin "-f", infile, # input file + "-c", "showpage", # showpage (see: https://bugs.ghostscript.com/show_bug.cgi?id=698272) ] if gs_windows_binary is not None: diff --git a/Tests/images/reqd_showpage.eps b/Tests/images/reqd_showpage.eps new file mode 100644 index 000000000..ffda2da41 Binary files /dev/null and b/Tests/images/reqd_showpage.eps differ diff --git a/Tests/images/reqd_showpage.png b/Tests/images/reqd_showpage.png new file mode 100644 index 000000000..b9ef86cb9 Binary files /dev/null and b/Tests/images/reqd_showpage.png differ diff --git a/Tests/test_file_eps.py b/Tests/test_file_eps.py index ecb34357a..54e806d81 100644 --- a/Tests/test_file_eps.py +++ b/Tests/test_file_eps.py @@ -71,6 +71,16 @@ class TestFileEps(PillowTestCase): target = Image.open('Tests/images/pil_sample_rgb.jpg') self.assert_image_similar(cmyk_image, target, 10) + def test_showpage(self): + # See https://github.com/python-pillow/Pillow/issues/2615 + plot_image = Image.open("Tests/images/reqd_showpage.eps") + target = Image.open("Tests/images/reqd_showpage.png") + + #should not crash/hang + plot_image.load() + # fonts could be slightly different + self.assert_image_similar(plot_image, target, 2) + def test_file_object(self): # issue 479 image1 = Image.open(file1)