Home » , » Figure format conversion in Linux

Figure format conversion in Linux


Manual conversion

  1. Open the file in the GIMP (make sure you have ghostscript installed! — Windows Ghostscript installation instructions)
    • Enter 500 in the “resolution” input box
    • You may need to uncheck “try bounding box”, since the bounding box sometimes cuts off part of the image.
      • Enter large values for Height and Width if not using the bounding box
    • Select color
    • Select strong anti-aliasing for both graphics and text
  2. Crop off extra whitespace (shift+C if you can’t find it in the toolbox)
  3. Image → Transform → Rotate 90 degrees clockwise
  4. Filters → Blur → Gaussian blur(No need to blur if you use strong anti-aliasing during conversion. No significant difference between end results.)
    • 2.0 px
  5. Image → Scale Image…
    • 25%
    • Cubic interpolation
  6. You can view at normal size if you want by pressing 1, Ctrl+E
  7. Save as File_name.png

Command-line method

Another route to convert a PS or EPS file (postscript) in png is to use ImageMagick, available on many operating systems. A single command is needed:
convert -density 300 file.ps file.png
The density parameter is the output resolution, expressed in dots per inch. With the standard 5×3.5in size of a gnuplot graph, this results in a 1500×1050 pixels PNG image. ImageMagick automatically applies antialiasing, so no post-processing is needed, making this technique especially suited to batch processing. The following Makefile automatically compiles all gnuplot files in a directory to EPS figures, converts them to PNG and then clears the intermediate EPS files. It assumes that all gnuplot files have a “.plt” extension and that they produce an EPS file with the same name, and the “.eps” extension:
GNUPLOT_FILES = $(wildcard *.plt) # create the target file list by substituting the extensions of the plt files FICHIERS_PNG = $(patsubst %.plt,%.png, $(GNUPLOT_FILES)) all: $(FICHIERS_PNG) %.eps: %.plt @ echo "compillation of "$< @gnuplot $< %.png: %.eps @echo "conversion in png format" @convert -density 300 $< $*.png @echo "end"


ps to eps is using command “ps2eps”
1) sudo apt-get install ps2eps
2) ps2eps -f inputfile

Export EPS from LaTeX 

latex draw.tex; dvips draw.dvi -E -o draw.eps
What is EPS file format? 
Encapsulated PostScript (EPS) is a standard file format for importing and exporting PostScript files. It is usually a single page PostScript program that describes an illustration or an entire page. The purpose of an EPS file is to be included in other pages. Sometimes EPS files are called EPSF files. EPSF simply stands for Encapsulated PostScript Format.
An EPS file can contain any combination of text, graphics and images. Since it is actually a PostScript file, it is one of the most versatile file formats that are available. EPS-files usually contain a small preview image that is used to visualize the content of the file.

See also:



Popular Posts