DEV Community

Cover image for TIL: The Best Way to Compress JPG Files with ImageMagick

TIL: The Best Way to Compress JPG Files with ImageMagick

Audrey Roy Greenfeld on April 09, 2020

Got a JPEG that's too big to upload? Lazy to open Photoshop? ImageMagick to the rescue! What Is ImageMagick? ImageMagick is a tool fo...
Collapse
 
rkyoku profile image
Renaud Kyoku

Thank you for the article!

Option 3 gave me... Well, a blurred image, even using the unsharp option mentionned in a comment.

Using option 1 gave me better results than plain PHP resizing using gd2, at the cost of a slightly increased file size + processing time.

Stay safe,

Collapse
 
dolo profile image
Clément Larduinat

Thank you !
I'll test the sampling factor.
If the compression is associated with a resize (responsive picture breakpoints) I use a unsharp rule -unsharp 0x0.75+0.75+0.008 to counteract the blurry inherent of resolution reduction.
Also test the webp format.

Collapse
 
audreyfeldroy profile image
Audrey Roy Greenfeld Feldroy

Thanks for the feedback, Clément! About testing the sampling factor, let me know how that goes! Those are good ideas about the unsharp rule and webp...I'll play with those.

Collapse
 
vamshi profile image
vamshi

Thanks for your article..
It helped me get the best image compression output for my website ( compressjpeg.online).

Collapse
 
fabio_tosto_62efa91d01bd0 profile image
Fabio Tosto