JPEG artifacts when resizing via libjpeg-turbo/mozjpeg but no artifacts resizing via official libjpeg
See original GitHub issueUsing sharp 0.18.2 to resize a jpeg on OSX 10.12.5 with a reasonable pipeline
const img = mod_sharp(input);
img.resize(415, 556);
img.jpeg({
quality: 85,
progressive: true,
chromaSubsampling: '4:2:0'
});
Noticeable artifacts in the following scenarios:
system vips with mozjpeg
1.brew install vips --with-mozjpeg --with-webp
2.npm install sharp
3.run reasonable sharp resize pipeline
4.Artifacts! https://www.dropbox.com/s/hxbsfziz70fct17/brew install vips --with-mozjpeg --with-webp.jpg?dl=0
system vips with jpeg turbo
1.brew install vips --with-webp --with-jpeg-turbo
2.npm install sharp
3.run reasonable sharp resize pipeline
4.Artifacts! https://www.dropbox.com/s/hl878dmsdm0f4w1/brew install vips --with-webp --with-jpeg-turbo.jpg?dl=0
Artifact-free in these scenarios:
systems vips (without jpeg turbo and without mozjpeg)
1.brew install vips ie. (no extra options. presumably bundled libjpeg is used?)
2.npm install sharp
3.run reasonable sharp resize pipeline
4.No artifacts! https://www.dropbox.com/s/hs6t0164ucsaqrj/brew install vips (no options).jpg?dl=0
bundled vips
1.brew remove vips
2.brew remove libjpeg-turbo
3.brew remove mozjpeg
4.npm install sharp (on mac os)
5.No artifacts! https://www.dropbox.com/s/bmb4stf6vn78jcf/vips bundled with sharp (macos).jpg?dl=0
vipsthumbnail (with jpeg turbo)
1.brew install vips --with-jpeg-turbo --with-mozjpeg
2.vipsthumbnail original.jpg -s 415x556 new.jpg[Q=85,no-subsample,optimize-coding,strip]
3.No artifacts! https://www.dropbox.com/s/shh8ykq2mvy5p54/vipsthumbnail [Q%3D85%2Cno-subsample%2Coptimize-coding%2Cstrip].jpg?dl=0
Summary
Artifacts arise when resizing jpegs via sharp when vips is compiled with jpeg-turbo (or mozjpeg). No artifacts when vips compiled against libjpeg.
Worth noting all of these scenarios are also reproducible on Ubuntu Trusty
Dropbox share to all test files + original https://www.dropbox.com/sh/aqtukbjdv0l8lom/AAAAtKp37f52b7SLunPwtBn4a?dl=0
Issue Analytics
- State:
- Created 6 years ago
- Comments:19 (9 by maintainers)

Top Related StackOverflow Question
sharp v0.19.0 now available.
Added https://github.com/lovell/sharp/pull/956 to expose
shrinkOnLoadinresize()