A BASH Script to convert multiple image files

EPS_TO_PNG is a BASH script which demonstrates how to automate a task in which the same command must be issued many times to convert files from EPS format to PNG format using the ImageMagick command convert.

A single file file.eps can be converted to PNG format by a command like

convert file.eps file.png
However, it is often the case that many files have to be converted; the straightforward approach would be to type the above command over and over, each time being careful to specify the next name from the list.

The BASH script can read a file specification such as "*.eps", expand it to a list of corresponding filenames, and form the correct invocation of convert for each of the files, handling the problem quickly and accurately.

The script has this form (EPS to PNG) because that's what I needed. It should be obvious how to change the script to do other kinds of conversions (JPEG to PNG) or to allow any kind of input file to be converted to TIFF, and so on.


./eps_to_png.sh files


The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

Related Data and Programs:

EPS, a data directory which contains examples of EPS files, the Encapsulated PostScript file format for 2D graphics;

EPS_TO_JPG, a BASH script which converts all EPS files to JPG format.

PNG, a data directory which contains examples of PNG files, a file format for 2D graphics;


  1. Cameron Newham, Bill Rosenblatt,
    Learning the BASH Shell,
    Third Edition,
    O'Reilly, 2005,
    ISBN: 978-0-596-00965-6,
    LC: QA76.O63.N458.
  2. Michael Still,
    The Definitive Guide to ImageMagick,
    Apress, 2005,
    ISBN13: 978-1590595909.

Source Code:

Examples and Tests:

Here is a collection of EPS files:

Here are the PNG files created by the script:

You can go up one level to the Examples page.

Last revised on 05 October 2011.