Problem description

The problem is to process 10000 pictures. Each picture is in hight quality, the goal is to create a smaller version of each one. There is a library libjpeg that provides suitable programs.

Useful programs from libjpeg:

djpeg

decompress a JPEG file to an image file

cjpeg

compress an image file to a JPEG file

Script signature for processing single picture:

Sample script in bash:

Example 1. Script make_smaller.sh

#!/bin/bash

QUALITY=30

if [ $# -ne 1 ]; then
	echo "arguments" 1>&2
	exit 1;
fi

FILE_PATH=$1

djpeg $FILE_PATH | cjpeg -quality $QUALITY