From b4a54dd0e420a6411f99329d0812a4133c0d105c Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Wed, 2 Sep 2015 23:51:31 +0300 Subject: [PATCH] .zshrc: Add GraphicsMagick version of smartresize GraphicsMagick is faster, often produces better results, has more sane command line options, etc... Signed-off-by: Alan Orth --- .zshrc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.zshrc b/.zshrc index 0ac5283..e6ceb0a 100644 --- a/.zshrc +++ b/.zshrc @@ -111,5 +111,13 @@ smartresize() { mogrify -path $3 -filter Triangle -define filter:support=2 -thumbnail $2 -unsharp 0.25x0.08+8.3+0.045 -dither None -posterize 136 -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 none -colorspace sRGB $1 } +# ported to graphicsmagick +# faster, more sane command line options, tags sRGB by default, etc +# image slightly larger but includes quite a bit of useful(?) metadata +# stripping with `jpegtran -copy none` strips 50KB+ off +gmsmartresize() { + 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 none -colorspace RGB -output-directory $3 $1 +} + export PATH export MANPATH