From 7873dfc5cbf035cd96807cc3c4d5215cc0065eae Mon Sep 17 00:00:00 2001 From: Brian Baumhover Date: Wed, 20 Jan 2016 20:12:08 -0600 Subject: [PATCH] Add optional size parameter to load for the EPS file loader. This allows an EPS file to be rasterized at a specified resolution other than integer multiples of the file specified bounding box as is the case with the scale parameter. --- PIL/EpsImagePlugin.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/PIL/EpsImagePlugin.py b/PIL/EpsImagePlugin.py index fb5bf7ffe..e818445a3 100644 --- a/PIL/EpsImagePlugin.py +++ b/PIL/EpsImagePlugin.py @@ -330,10 +330,13 @@ class EpsImageFile(ImageFile.ImageFile): return (length, offset) - def load(self, scale=1): + def load(self, scale=1, size=None): # Load EPS via Ghostscript if not self.tile: return + # Override the size of the image if specified + if not size is None: + self.size = size self.im = Ghostscript(self.tile, self.size, self.fp, scale) self.mode = self.im.mode self.size = self.im.size