#!/bin/bash
# Converts an Solarium 55 image to a better format for online viewing.
# The principal parameter that I think is adjustable here as far as image 
# quality is concerned is "-quality".  At 50, the visible artifacts are
# still there, but I think they're very acceptable, and the image is
# ~150K.  At 25 (~100K), they start to be objectionable in my eyes, and
# at 10 (~50K) they are very obvious to anyone, but the text can still be
# read.  The other things that might be adjustable are the crop offsets
# (+X+Y).
#
# Syntax:
#	solarium55.sh Infile Outfile [OPTIONS]
# The OPTIONS are options for 'convert', usually contrast adjustments.

NAME=`echo $2 | sed "s/JPG/jpg/"`

if test -f $NAME
then
	echo File $NAME already exists
else
	echo "Processing $1 -> $NAME"
	convert $1 -contrast -contrast -contrast -contrast \
		-colorspace Gray -colors 256 $3 $4 $5 $6 $7 $8 $9 \
		-density 150x150 -crop 2204x1648+210+70 \
		-scale 1337x1000 -quality 50 $NAME
fi
