'
set col=0
foreach gif ( $argv[1-] )
# filename of icon image by adding _s to the basename and switching from jpeg to gif
set smallgif=`basename $gif .gif`
set smallgif=`basename $smallgif .jpeg`
set smallgif=${smallgif}.gif
set smallgif=`echo $smallgif | sed 's/\./_s\./'`
# icon image with maximum edge length of 100, maintaining side length ratio
convert -geometry ${pixwidth}x${pixwidth} $gif $smallgif
# fold -b -w 6 $smallgif | head -1 should read 'GIF89a'
# first 6 bytes are GIF89a, next two are width, next two are height
# swab bytes 7-8 and 9-10 because they are wrong endian
# Using |& and only the first two bytes seen by od deletes the '1+0 records in, 0+1 records out' messages
# by dd (there seems not to be any option to do this)
set width=`dd ibs=2 skip=3 count=1 conv=swab if=$smallgif |& od -d -A n -N 2`
set height=`dd ibs=2 skip=4 count=1 conv=swab if=$smallgif |& od -d -A n -N 2`
# a method to delete leading zeros from the number representations left over by od
@ width= $width + 0
@ height= $height + 0
echo '' ' '
set bytes=`ls -g $gif | awk '{printf "%.0f",$4/1000}'`
echo $gif '(' $bytes 'kbytes) | '
@ col++
if ( $col == 4 ) then
echo '
'
echo
echo '