Created
August 20, 2020 15:41
-
-
Save samcre/ea936b99056e4b19537cf567f8d70eb3 to your computer and use it in GitHub Desktop.
Optimize images for web
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Optimize PNG files with pngcrush | |
find . -type f -iname "*.png" -exec pngcrush -ow {} \; | |
# Optimize JPG & JPEG files with ImageMagick following this recommendations: https://dev.to/feldroy/til-strategies-for-compressing-jpg-files-with-imagemagick-5fn9 | |
find . -type f -iname "*.jpg" -exec convert {} -sampling-factor 4:2:0 -strip -quality 85 -interlace Plane -gaussian-blur 0.05 -colorspace RGB {} \; | |
find . -type f -iname "*.jpeg" -exec convert {} -sampling-factor 4:2:0 -strip -quality 85 -interlace Plane -gaussian-blur 0.05 -colorspace RGB {} \; | |
# Optimize SVG images using SVGO | |
find . -type f -iname "*.svg" -exec svgo -i {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment