Converting .eps to .png Easily :: Dammit Jim! I end up generating a lot of postscript plots in R and other programs. Unfortunately, a lot of not so technical people have trouble opening postscript files so I end up having to convert these images to other formats pretty often. A really handy program for converting eps files to png (or jpg although that's not really an optimal format for plots) is ImageMagick (available for all OSs I believe).
ImageMagick lets you quickly convert (and create thumbnails, make B&W,...) from the command line without having to open up Photoshop. For example, to convert an image named myPlot.eps to png you just need to enter convert myPlot.eps myPlot.png (convert is a program in the ImageMagick package) at the command prompt and you'll get a png file in myPlot.png. If you want to adjust the resolution (the default resolution is 72 dpi) of the output image, you can add the -density option (e.g. for 200 dpi convert -density 200 myPlot.eps myPlot.png). Black Background Problem. View topic - can i stitch to images together side by side? View topic - Convert EPS to JPEG wrong Bounding Box size ? Fred's ImageMagick Scripts. Licensing: Copyright © Fred Weinhaus My scripts are available free of charge for non-commercial (non-profit) use, ONLY.
For use of my scripts in commercial (for-profit) environments or non-free applications, please contact me (Fred Weinhaus) for licensing arrangements. My email address is fmw at alink dot net. If you: 1) redistribute, 2) incorporate any of these scripts into other free applications or 3) reprogram them in another scripting language, then you must contact me for permission, especially if the result might be used in a commercial or for-profit environment. Usage, whether stated or not in the script, is restricted to the above licensing arrangements. Please read the Pointers For Use on my home page to properly install and customize my scripts. ImageMagick and auto-cropping. Imagemagick is an open-source collection of graphics utilities which includes the convert command. This command makes it possible to scale, compress and otherwise manipulate images of many different types, including both bitmap (jpeg, gif etc.) and vector formats (pdf etc.).
It used to be possible to crop images automatically by including the command-line option convert -crop 0x0. In some versions of this software on Mac OS X, this option doesn't work. In my current version of the software, images can be cropped by typing convert -trim instead. If this does not work for you (there was a period when this did not work on my system), you may want to read on. As a workaround, one can use the following combination (which you can store as an executable shell script, perhaps call it cropImage): #! The script takes one argument: the image file name (which can be any image format recognized by convert.
As prerequisites you need to install the packages imagemagick and netpbm from fink. Unix - Can ImageMagick return the image size. Command-line Tools: Convert. Convert pdf to png with imagemagick | robfelty.com. Imagemagick is a swiss-army knife of command-line image conversion, but can be a bit complicated to actually use. I have been making most of my figures with R lately, and printing them to pdfs, which I can include very easily into documents with pdflatex. I like pdf because it is scalable, fairly small file size (smaller than .eps), and portable. But today a colleague wanted to include a few of my figures in her own powerpoint presentation, and powerpoint only likes bitmaps. She was just going to take screenshots of the figures, but I quickly said, “no, I will just convert them to pngs”. For file in *.pdf; do \echo $file;\ convert -density 600x600 -resize 800x560 -quality 90 $file `echo $file|cut -f1 -d' And now the code explained: -density 600×600 says treat the pdf as 600×600 dpi resolution -quality 90 says use the highest compression level for png (9) and no filtering (0) -resize 800×560 gives the dimensions in pixels of the resulting png file Happy ImageMagicking!