chrisdwheatley / netlify-plugin-image-optim

Optimize images as part of your Netlify build process. Optimizes PNG, JPEG, GIF and SVG file formats.
MIT License
63 stars 11 forks source link

Replace jpegtran with mozjpeg #30

Closed BezPowell closed 3 years ago

BezPowell commented 3 years ago

This pr replaces the imagemin-jpegtran plugin with imagemin-mozjpeg. This should result in smaller filesizes for jpegs and progressive encoding by default, closing issue #28.

The mozjpeg defaults seem pretty sane from a run on my site, but exposing some of the options might be a nice improvement.

cascading-jox commented 3 years ago

I support this pr!

BezPowell commented 3 years ago

I support this pr!

I've actually being using this for a while and in my testing it looks like mozjpeg always re-encodes files which can result in a loss of quality. This behaviour could be what people want, in which case something like imagemin-jpeg-recompress might be a better fit, as it should attempt to do this with as little loss in quality as possible. Alternatively, using imagemin-jpegtran with progressive enabled would be fully lossless.

While mozjpeg works fine for my personal use, it's probably not the best default option for everybody, so I should probably close this pr.