EPS_TO_JPG
A BASH Script to convert multiple image files


EPS_TO_JPG 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 JPEG format using the ImageMagick command convert.

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

convert file.eps file.jpg
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 JPEG) 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.

Usage:

./eps_to_jpg.sh files
where

Licensing:

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_PNG, a BASH script which converts all EPS files to PNG format.

JPG, a data directory which contains examples of JPG or JPEG files, a file format for high quality 2D graphics;

Reference:

  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 JPG files created by the script:

You can go up one level to the Examples page.


Last revised on 09 March 2011.