AFAIK, , EPS - . DPI, .
- eps. (?) .eps ( ). PythonMagick , PIL, . - OP
, EPS PythonMagick EPS (, IM, , " " ) - PIL EPS EPS.
. " " ImageMagick:
? IM " ", , , . , , IM , , ( ), , . , IM . , . ( ) , . , IM . IM , PDF Postscript, "" , "" , . , ... ImageMagick " " " " EG: , : PDF, PS, SVG , . ImageMagick .
. EPS PIL:
PIL EPS, , , ( ImageData). Ghostscript, EPS . EPS EPS.
[ 1]
PIL " " :
Ghostscript, load() , , Ghostscript EPS
. EPS , 100px x 100px, 2 , Ghostscript 200px x 200px. :
im = Image.open(...)
im.size
im.load(scale=2)
im.size
[ 2]
, PIL . EPS, . OP, , -, 72 ppi .
, - 72 ( ), , , - r , s - : 1 : s = 72 : r ergo:
im.load(scale=300.0/72.0)
, - , 1677 :
def open_eps(filename, width=None):
original_width = float(Image.open(filename).size[0])
im = Image.open(filename)
if width is not None:
im.load(scale=width/original_width)
return im
im = open_eps('testfile.eps', 1677)
, : ppi EPS , scale . , , PR .
[ 3]
, , , ... 4,166666667 (300,0/72,0) 4.
.
def open_eps(filename, width=None):
original = [float(d) for d in Image.open(filename).size]
scale = width / original[0]
im = Image.open(filename)
if width is not None:
im.load(scale=math.ceil(scale))
if scale != 1:
im.thumbnail([int(scale * d) for d in original], Image.ANTIALIAS)
return im
im = open_eps('testfile.eps', 1677)
, math.round int, .