vigata / petitoJPEG

A high performance JPEG Encoder written in JavaScript
Other
70 stars 13 forks source link

Better chroma subsampling #5

Open Ser-Gen opened 5 years ago

Ser-Gen commented 5 years ago

Current subsampling implementation, as in libjpeg, makes contrast colors look blurry. There are an attempts to make it better.

source 186289 source

petitojpeg 90 4:2:0 51118 petitojpeg 90 420

sjpeg 90 4:2:0 sharp 51071 sjpeg 90 420sharp

About implementations. Some info from mozjpeg issues. https://github.com/mozilla/mozjpeg/issues/8 https://github.com/mozilla/mozjpeg/issues/193 https://github.com/kornelski/jpeg-compressor#subsampling https://github.com/kornelski/jpeg-compressor/blob/9eeb009fdb8673224de5be978574cb139e4b8bf6/jpge.cpp#L611

sjpeg has sharp yuv, like in webp, gives closer result. https://github.com/webmproject/sjpeg