#!/bin/sh if [ $# -gt 2 -o $# -lt 1 ]; then echo "Usage: size onefile";exit 1;fi LIMIT=100 width=`file $1 | awk ' { print $5 } ' | sed 's/,$//'` height=`file $1 | awk ' { print $7 } ' | sed 's/,$//'` while [ $height -gt $LIMIT ]; do height=$[$height/2] width=$[$width/2] done echo $height $width