#!/usr/bin/env bash for PHOTO in *_s.jpg do BASE=`basename $PHOTO .jpg` convert $PHOTO "$BASE.png" convert "$BASE.png" -fuzz 1% -transparent white "$BASE.png" done