Node: Converting EPS Files, Next: , Previous: Running 3DLDF, Up: Running 3DLDF



Converting EPS Files

ImageMagick is a "collection of tools and libraries" for image manipulation. It provides a `convert' utility which can convert images from one format to another. It can convert structured PostScript (PS) to to Portable Network Graphics (PNG), but not EPS (Encapsulated PostScript) to PNG. Nor can it convert EPS to structured PostScript.

It is possible to have MetaPost generate structured PostScript directly by including the command prologues:=1; at the beginning of the MetaPost input. However, this "generally doesn't work when you use TeX fonts."1 This is a significant problem if your labels contain math mode material, and you haven't already taken steps to ensure that appropriate fonts will be used in the PS output.

In the following, I describe the only way I've found to convert an EPS image to PNG format while still using TeX fonts. There may be other and better ways of doing this, but I haven't found them.

  1. Assume the EPS image is in the file 3DLDFmp.1 Include the EPS image in a TeX file which looks like this:
              \advance\voffset by -1in
              \advance\hoffset by -1in
              \nopagenumbers
              \input epsf
              \epsfverbosetrue
              \def\epsfsize#1#2{#1}
              \setbox0=\vbox{\epsffile{3DLDFmp.1}}
              \vsize=\ht0
              \hsize=\wd0
              \special{papersize=\the\wd0,\the\ht0}
              \box0
              \bye
              

    Do not name this file 3DLDFmp.1.tex! While this worked fine for me on a DECalpha Personal Workstation running under Tru64 Unix 5.1, with TeX, Version 3.1415 (C version 6.1), and dvipsk 5.58f, it failed on a PC Pentium II XEON under Linux 2.4, with TeX, Version 3.14159 (Web2C 7.4.5), and dvips(k) 5.92b, kpathsea version 3.4.5, with the following error message:

              ``No BoundingBox comment found in file examples.1; using defaults''
              

    The resulting PS image had the wrong size and the the graphic was positioned improperly.

    Apparently, it confuses the EPSF macros when the name of an included image is the same as \jobname. So, for this example, let's call it 3DLDFmp.1_.tex.

    You don't really need to call the macro \epsfverbosetrue. If you do, it will print the measurements of the bounding box and other information to standard output.2

  2. Run tex 3DLDFmp.1_.tex.
  3. Run dvips -o 3DLDF.1.ps 3DLDFmp.1_.dvi.
  4. Run convert 3DLDF.1.ps 3DLDFmp.1.png.
ImageMagick supplies a `display' utility, which can be used to display the PNG image:
     display 3DLDFmp.1.png
     

It can be included in an HTML document as follows:

     <img src="3DLDFmp.1.png"
              alt="[Fig. 1]."
     

Please note! The PNG files for this manual are now called filename 3DLDF1.png, 3DLDF2.png, ..., 3DLDF199.png, because I wasn't able to write files with names like 3DLDFmp.<number>.png to a CD-R (Compact Disk, Recordable), when `number' had more than one digit.


Footnotes

  1. Hobby, A User's Manual for MetaPost, pp. 21--22.

  2. Rokicki, Dvips: A DVI-to-PostScript Translator, p. 24.