Skip to content

Instantly share code, notes, and snippets.

@sagax
Created October 28, 2018 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sagax/500171eb4d8cdd18053fa80d9b40fc4e to your computer and use it in GitHub Desktop.
Save sagax/500171eb4d8cdd18053fa80d9b40fc4e to your computer and use it in GitHub Desktop.
compression original image with convert
[[ -f "$1" ]] && \
NAME="$1" && \
sname=$(awk -F_original '{print $1}' <<< $NAME) && \
extname=$(cut -d"." -f2 <<< $NAME) && \
convert $NAME \
-sampling-factor 4:2:0 \
-strip \
-quality 85 \
-interlace JPEG \
-colorspace sRGB \
-resize 50%x \
"${sname}.${extname}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment