#!/bin/sh
# png2sc - scale down PNG image (default 1600 pixels wide)
# Copyright (c) 2010-2024 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: png2sc file [file ...]

for i in "$@"
do
	infile=$i
    outfile=$(basename "$i" .png)-sc.png

	echo "converting $infile to $outfile..."
	pngtopnm "$infile" | pnmcrop -sides -right | pnmgamma 1.3 | pamscale --height "${MED_SIZE:-1600}" | pnmtopng -compression=9 > "$outfile"
	echo
done
