From 730319bcd124f0766aacf59d8463f6883d99f93a Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Sun, 30 Aug 2015 17:58:36 +0300 Subject: [PATCH] .zshrc: Add smartresize function For quick and easy image resizing. From Smashing Magazine's great article[0]. [0] http://www.smashingmagazine.com/2015/06/efficient-image-resizing-with-imagemagick/ Signed-off-by: Alan Orth --- .zshrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.zshrc b/.zshrc index f24a8c2..0ac5283 100644 --- a/.zshrc +++ b/.zshrc @@ -102,5 +102,14 @@ fi # If heroku toolbelt is installed, add it to PATH [[ -d /usr/local/heroku/bin ]] && PATH=$PATH:/usr/local/heroku/bin +# resize images using ImageMagick +# +# $ smartresize DSC_0788.JPG 1920 outputdir +# +# see: http://www.smashingmagazine.com/2015/06/efficient-image-resizing-with-imagemagick/ +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 +} + export PATH export MANPATH