.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/
This commit is contained in:
Alan Orth 2016-08-14 23:04:01 +03:00
parent 3d63c2aa29
commit d91f2ed127
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9

4
.zshrc
View File

@ -123,7 +123,7 @@ fi
# Similar to the one from SmashingMagazine, but ported to GraphicsMagick # Similar to the one from SmashingMagazine, but ported to GraphicsMagick
# see: http://www.smashingmagazine.com/2015/06/efficient-image-resizing-with-imagemagick/ # see: http://www.smashingmagazine.com/2015/06/efficient-image-resizing-with-imagemagick/
smartresize() { 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 # optimize jpeg using GraphicsMagick
@ -134,7 +134,7 @@ smartresize() {
jpegoptimize() { jpegoptimize() {
if [[ -z $3 ]]; then QUALITY=82; else QUALITY=$3; fi 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: # generate random password 25 characters long: