# Reads a list of images with TIFF and "raw" PPM versions,
# prints the tiffs that can probably be removed.
# Input format: TX TY PX PY NAME
# Where TX,TY are the TIFF dimensions, PX,PY are the raw PPM dimensions,
# and NAME is the image name with the ".tiff" or the "-raw.ppm"
# replaced by just "."

function sim(ts,ps,  d) 
{
  if (ts == ps) return 1;
  if ((ts == 0) || (ps == 0)) return 0;
  if (ts < ps) 
    { printf "%s: TIFF smaller than raw PPM\n", $5 > "/dev/stderr";
      return 0;
    }
  return ((ts - ps) < ts/20);
}
    
((($1 != 0) || ($2 != 0)) && sim($1,$3) && sim($2,$4)) { print; next; }