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.

This commit is contained in:
Brian Baumhover 2016-01-20 20:12:08 -06:00
parent 46ad0e2555
commit 7873dfc5cb

View File

@ -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