[OS X TeX] GhostScript assistance needed!

Piet van Oostrum piet at cs.uu.nl
Mon Apr 24 15:45:13 CEST 2006


>>>>> Peder Axensten <peder at axensten.se> (PA) wrote:

>PA> I need to use Ghost Script (without any perl scripts or similar) to
>PA> convert an .eps file to .pdf. Normally I do this with epstopdf, but  now I
>PA> need a more independent way of doing it using only GS. How  would the
>PA> command look like? (Why is epstopdf needed anyway? Must be  an awfully
>PA> complicated GS command...)

epstopdf extracts the bounding box from the EPS file and prefixes the file
with some additional Postscript code to shift the lower left corner to
(0,0) and to set the pagesize to the size of the EPS. After that the gs
command is quite simple:

gs -q -sDEVICE=pdfwrite -dAutoRotatePages=/None -sOutputFile='$OutputFilename' '$InputFilename' -c quit

>PA> Sometimes a .png or .jpeg would be better due to the complexity of  the
>PA> vector graphics. How would the command look like to convert  from .eps to
>PA> .png/.jpeg at a resolution 'res'?

-r res -sDEVICE=png256 

>PA> Can GS convert to .emf (MicroSoft)? How would such a command look like?

>PA> The result will be coded into a .m Matlab function and uploaded to  the
>PA> Mathworks Central File Exchange. That's why I want to depend only  on GS
>PA> being available. Matlab has commands to save as .png/,jpeg  etc., but the
>PA> resulting files of the same figure have different  amount of whitespace
>PA> around them, different shades of colors etc.  The .eps files always look
>PA> good, however.

You could give the pagesize as gs option (-g'width'x'height'). The lower
left corner might already be at (0.0)
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org
------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/




More information about the macostex-archives mailing list