Created
October 9, 2019 17:18
-
-
Save yene/cb4f7f7b2b0be42c974694a58d0cae97 to your computer and use it in GitHub Desktop.
Automator convert images to webp, keep mod and creation date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# automator Passes images in as argument | |
for f in "$@" | |
do | |
dc="$(GetFileInfo -d "$f")" # store creation date | |
dm="$(GetFileInfo -m "$f")" # store modification date | |
noExt=${f%.*} | |
# needs to be installed with brew install webp | |
newExt="$noExt".webp | |
/usr/local/bin/cwebp -q 90 "$f" -o "$newExt" | |
SetFile -d "$dc" "$newExt" # restore creation date | |
SetFile -m "$dm" "$newExt" # restore modification date | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment