Skip to content

Instantly share code, notes, and snippets.

@ahsquared
Last active March 7, 2019 19:04
Show Gist options
  • Save ahsquared/f84157c82161bd178738db873bcd1886 to your computer and use it in GitHub Desktop.
Save ahsquared/f84157c82161bd178738db873bcd1886 to your computer and use it in GitHub Desktop.
Compress JPG with ImageMagick
convert -strip -interlace Plane -sampling-factor 4:2:0 -define jpeg:dct-method=float -quality 70% source.jpg output.jpg
@ahsquared
Copy link
Author

From: http://stackoverflow.com/questions/7261855/recommendation-for-compressing-jpg-files-with-imagemagick
From @Fordi in the comments (don't forget to thumbs up his comment if you like): If you dislike blurring, use -sampling-factor 4:2:0 instead. What this does is reduce the chroma channel's resolution to half, without messing with the luminance resolution that your eyes latch onto. If you want better fidelity in the conversion, you can get a slight improvement without an increase in filesize by specifying -define jpeg:dct-method=float - that is, use the more accurate floating point discrete cosine transform, rather than the default fast integer version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment