Figure format conversion

From GHER

Jump to: navigation, search

General conversions

The software Imagemagick offers the tool convert, able to perform the most common format conversions in command line.

If you want to apply the transformation to a list of files, you can use a script similar to:

for ii in `ls *.pdf`
do
       ff=`basename $ii .pdf`
       ff=${ff}'.png'
       echo $ii '-->' ${ff}
       convert -quality 100 -density 300 $ii $ff
done

which will convert all the pdf files into png files.

Postscript (or encapsuled postscript) to pdf

ps2pdf -dEPSCrop figureIN.eps figureOUT.pdf

ps2pdf manual: http://pages.cs.wisc.edu/~ghost/doc/AFPL/6.50/Ps2pdf.htm

pdf to png

convert -density 500x500 figureIN.pdf figureOUT.png

the argument of density specifies the pdf dpi resolution.

Check also http://robfelty.com/2008/03/11/convert-pdf-to-png-with-imagemagick

Personal tools