From d91f2ed127ef5a912869a9b7533904c55052a6d2 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Sun, 14 Aug 2016 23:04:01 +0300 Subject: [PATCH] .zshrc: Update GraphicsMagick helpers to produce better images I noticed a blog post pointing out that resized images usually end up looking a bit dim or blurry. He suggested some different unsharp settings, and they do produce an image with more detail. See: https://even.li/imagemagick-sharp-web-sized-photographs/ --- .zshrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.zshrc b/.zshrc index bc58764..8d0d84a 100644 --- a/.zshrc +++ b/.zshrc @@ -123,7 +123,7 @@ 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 0.25x0.08+8.3+0.045 -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 + 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 } # optimize jpeg using GraphicsMagick @@ -134,7 +134,7 @@ smartresize() { jpegoptimize() { if [[ -z $3 ]]; then QUALITY=82; else QUALITY=$3; fi - gm mogrify -filter Triangle -define filter:support=2 -unsharp 0.25x0.08+8.3+0.045 -dither -quality $QUALITY -define jpeg:fancy-upsampling=off -interlace Line -strip -output-directory $2 $1 + gm mogrify -filter Triangle -define filter:support=2 -unsharp 2x0.5+0.7+0 -dither -quality $QUALITY -define jpeg:fancy-upsampling=off -interlace Line -strip -output-directory $2 $1 } # generate random password 25 characters long: