PIL Bug while converting EPS files to PNG

Brandon George <[email protected]> Fri, 7 Dec 2012 10:46:03 -0800
Newsgroups gmane.comp.python.image
Message-ID <CAK-73kUZYJv2M9jSuCuojmb7L50mUnG_eYW_0fdfwkWar6cYaw@mail.gmail.com>
--===============1150471459==
Content-Type: multipart/alternative; boundary=e89a8fb1eb8ad6d9ba04d047a1e7

--e89a8fb1eb8ad6d9ba04d047a1e7
Content-Type: text/plain; charset=ISO-8859-1

I wrote a simple implementation of PIL to convert a list of EPS files to
PNG. The output PNG files are at a much lower resolution than required. And
there seems to be no way to fix it.

Looking at /usr/lib64/python2.7/site-packages/PIL/EpsImagePlugin.py this is
implemented by calling ghostscript:



# Build ghostscript command

command = ["gs",

           "-q",                    # quite mode

           "-g%dx%d" % size,        # set output geometry (pixels)

           "-dNOPAUSE -dSAFER",     # don't pause between pages, safe mode

           "-sDEVICE=ppmraw",       # ppm driver

           "-sOutputFile=%s" % file,# output file

           "- >/dev/null 2>/dev/null"]





the size option only changes the output figure size but does not rescale
it, I can make the output image larger, but not higher resolution because
the EPS file is being imported at a low resolution.



Any help would be appreciated.


Thanks



Brandon

--e89a8fb1eb8ad6d9ba04d047a1e7
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<p style=3D"margin-top:0in;margin-right:0in;margin-bottom:12.0pt;margin-lef=
t:0in;line-height:12.5pt;background:white;vertical-align:baseline"><span st=
yle=3D"font-size:10pt;font-family:Arial,sans-serif">I wrote a
simple implementation of PIL to convert a list of EPS files to PNG. The out=
put
PNG files are at a much lower resolution than required. And there seems to =
be
no way to fix it.</span></p>

<p class=3D"MsoNormal">Looking at
/usr/lib64/python2.7/site-packages/PIL/EpsImagePlugin.py this is implemente=
d by
calling ghostscript:</p>

<p class=3D"MsoNormal">=A0</p>

<p class=3D"MsoNormal"># Build ghostscript command</p>

<p class=3D"MsoNormal">command =3D [&quot;gs&quot;,</p>

<p class=3D"MsoNormal">=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0
&quot;-q&quot;,=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0
# quite mode</p>

<p class=3D"MsoNormal">=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0
&quot;-g%dx%d&quot; % size,=A0=A0=A0=A0=A0=A0=A0
# set output geometry (pixels)</p>

<p class=3D"MsoNormal">=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0
&quot;-dNOPAUSE -dSAFER&quot;,=A0=A0=A0=A0
# don&#39;t pause between pages, safe mode</p>

<p class=3D"MsoNormal">=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0
&quot;-sDEVICE=3Dppmraw&quot;,=A0=A0=A0=A0=A0=A0
# ppm driver</p>

<p class=3D"MsoNormal">=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0
&quot;-sOutputFile=3D%s&quot; % file,# output file</p>

<p class=3D"MsoNormal">=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 &quot;-
&gt;/dev/null 2&gt;/dev/null&quot;]</p>

<p class=3D"MsoNormal">=A0</p>

<p class=3D"MsoNormal">=A0</p>

<p class=3D"MsoNormal">the size option only changes the output figure size =
but does
not rescale it, I can make the output image larger, but not higher resoluti=
on
because the EPS file is being imported at a low resolution.</p>

<p class=3D"MsoNormal">=A0</p>

<p class=3D"MsoNormal">Any help would be appreciated.</p>

<p class=3D"MsoNormal"><br>
Thanks</p>

<p class=3D"MsoNormal">=A0</p>

<p class=3D"MsoNormal">Brandon</p>

--e89a8fb1eb8ad6d9ba04d047a1e7--

--===============1150471459==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Image-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/image-sig

--===============1150471459==--