#!/bin/sh
# png2tn - scale down PNG image to a thumbnail image
# Copyright (c) 1996-2022 by Ian Kluft
# Redistribution permitted by the author under the conditions of the
# GNU General Public License Version 3.
#    https://opensource.org/licenses/GPL-3.0
#
# usage: png2tn file [file ...]
# copies and scales down PNG images to 100 pixel high thumbnails at the same aspect ratio

for i in $*
do
	infile=$i
	outfile=`basename $i .png`-tn.png

	echo "converting $infile to $outfile..."
	pngtopnm $infile | pnmcrop | pnmscale -ysize 100 | pnmtopng -compression 9 > $outfile
	echo
done
