vt-resize-pictures is a really simple ImageMagick wrapper written in Bash aimed at batch image resizing. Currently it uses hardcoded parameters and users are encouraged to adjust the script to meet their needs.

Code Example

#!/usr/bin/env bash

echo 'Original:'
ls -l *.JPG


echo 'Resized:'
ls -l resized_pictures/*

# Example output:
# Original:
# -rw-rw-r--. 1 voj-tech voj-tech 4388271 Apr 20  2016 P1050809.JPG
# -rw-rw-r--. 1 voj-tech voj-tech 4531403 Apr 20  2016 P1050810.JPG
# Resized:
# -rw-rw-r--. 1 voj-tech voj-tech 728966 Aug 11 01:25 resized_pictures/P1050809.JPG
# -rw-rw-r--. 1 voj-tech voj-tech 746587 Aug 11 01:25 resized_pictures/P1050810.JPG


vt-resize-pictures was originally a script for my personal use but it might come in handy as a template to others as well.



It is required that your environment features reasonably new versions of:

  • ImageMagick
  • the find and xargs command line utilities
  • the GNU core utilities
  • Bash

It should be noted that the script has been tested using ImageMagick, findutils 4.6.0 (provides the find and xargs utilities), coreutils 8.30 and Bash 4.4.23 on Fedora 29.

Installation Steps

No actual installation is needed. To start using the script follow these steps:

  1. Download a ZIP file with the required version of the script from this page. Most likely you want the latest version.

  2. Unpack the downloaded file and add the execute mode bit to the vt-resize-pictures.sh script file mode bits.

    unzip vt-resize-pictures-0.8.2.zip && chmod +x vt-resize-pictures-0.8.2/vt-resize-pictures.sh
  3. Optionally copy the script to a directory which is in your PATH environment variable for convenience. This might be the ~/bin directory for example.

    cp vt-resize-pictures-0.8.2/vt-resize-pictures.sh ~/bin



./vt-resize-pictures.sh [DIRECTORY]

Resize JPEG images in DIRECTORY (the current directory by default).


The script resizes all the images identified as files with the .jpg filename extension found directly in the specified directory and places the output images to an output directory. The output directory has the name resized_pictures and is created in the directory with the input images. The output images have the same file names as their input counterparts.

The actual operation of resizing the images is done using ImageMagick with a set of hardcoded parameters. The images are resized proportionally and the output images have the width of 1280 pixels, the compression level (quality) of 98 and the sampling factor of 4:2:2.

Exit Status

Typically the vt-resize-pictures.sh script exits with the status of the last command which is to remove a temporary file used internally by the script. This is 0 if it succeeds, otherwise it is a value greater than 0. However the script exits with status:

  • 1 if the output directory cannot be created
  • 2 if no JPEG images are found


Suggestions and bug reports are more than welcome at voj-tech@voj-tech.net.