#! /usr/bin/env bash sourcePath=${1} sourceDirectory=$(dirname ${sourcePath}) sourceFile=$(basename $sourcePath) targetFile=${sourceFile%%.*}.jpg targetPath=${sourceDirectory}/${targetFile} echo "Processing ${sourcePath}" convert -resize "2048>" ${sourcePath} ${targetPath} guetzli ${targetPath} ${targetPath}