Novell is now a part of Micro Focus

Bash Batch Image Processing Script

Novell Cool Solutions: Cool Tool

Digg This - Slashdot This

In Brief

Manipulate entire directories of images all at once.


Functional Categories:
  • BASH
  • Linux
  • Scripting
  • Updated:10 Oct 2006
    File Size:52KB
    License:GNU General Public License (GPL)
    Publisher:David Crouse


    Please read the note from our friends in legal before using this file.


    Actually, it's just a simple (well, somewhat simple) set of bash functions all put together in one script with a menu (of sorts) to help you work on batches (entire directories) of images, all at once. I do some web design, and I like to take digital pictures, and have thousands of them. While uploading images to some fancy photogallery software is fine for a few images, I wanted to harness the power of Linux and Imagemagick to create something that could be run from a command line on images on a server that didn't use X, and that could run very fast and without interaction if I wanted it to, or that could accept user input.

    Why bash? Well, because I like bash, and am still learning how to use it, and it seemed like a good idea at the time. So, while I know of other projects that do this, I don't know of any that use bash. I could be wrong, there very well could be a bash script that does all this already, but it's good practical experience anyway. I've seen some that use perl, some that use c and some that use python, but never anything very large using bash. Bash comes installed with almost every major Linux system, so there wouldn't be the need for php, perl, python, or even the use of a compiler to run it. Just about the only needed application is Imagemagick. Talk about simple :)

    So basically, it's my project I'm doing to learn more about bash and it's limits and possibilities. I don't claim it to be great programming, but it proved useful to me on several occasions, so I thought I'd share it. If you like the program, great; if not, feel free to suggest things or comment on it. Development can be tracked at and

    Changelog notes:

    • Major code changes in several functions. Updated version number to .0.4.0
    • YOUR CURRENT WORKING DIRECTORY IS ~~ Made it display bold.
    • Added several functions to allow for spaces in filenames and directories. Modified several functions to make use of the command line utilities that were added in.
    • Fixed some bash coding to make it a bit more elegant. IMHO (Still needs lots of work i know)
    • list_images function changed to list ONLY jpg's or JPG's
    • Removed the zip function.
    • Fixed tar and gzip functions to ONLY include the jpegs.
    • Image Functions now create directories with useful information at the end of the directory name, making it easier to keep track of what you did to the images in that directory.
    • Fixed bbresize -- removed the -size option... only using -resize now.

    Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions.

    © Copyright Micro Focus or one of its affiliates