bash script to apply different image optimization steps for JPG and PNG images