From 55868c7122f15520426abdb712215bb1105acad8 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Sat, 19 Nov 2016 18:01:25 +0200 Subject: [PATCH] .zshrc: Allow optional quality parameter to smartresize --- .zshrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.zshrc b/.zshrc index 15ed20c..abc336d 100644 --- a/.zshrc +++ b/.zshrc @@ -99,7 +99,9 @@ fi # Similar to the one from SmashingMagazine, but ported to GraphicsMagick # see: http://www.smashingmagazine.com/2015/06/efficient-image-resizing-with-imagemagick/ smartresize() { - gm mogrify -filter Triangle -define filter:support=2 -thumbnail $2 -unsharp 2x0.5+0.7+0 -dither -quality 82 -define jpeg:fancy-upsampling=off -define png:compression-filter=5 -define png:compression-level=9 -define png:compression-strategy=1 -define png:exclude-chunk=all -interlace Line -strip -output-directory $3 $1 + if [[ -z $4 ]]; then QUALITY=82; else QUALITY=$4; fi + + gm mogrify -filter Triangle -define filter:support=2 -thumbnail $2 -unsharp 2x0.5+0.7+0 -dither -quality $QUALITY -define jpeg:fancy-upsampling=off -define png:compression-filter=5 -define png:compression-level=9 -define png:compression-strategy=1 -define png:exclude-chunk=all -interlace Line -strip -output-directory $3 $1 } # optimize jpeg using GraphicsMagick