image-encode
image-encode copied to clipboard
JPG quality options buggy
I tried following qualities on the same image:
- quality: 0.5 => ~450 kb
- quality: 0.8 => ~900 kb
- quality: 0.9 => ~1500 kb
- quality: 0.95 => ~2500 kb
- quality: 1 => ~4500 kb
- quality: 2 => ~1800 kb
- quality: 100 => ~1800 kb
Within the app:
jpeg.encode(rawImageData, o.quality ? o.quality * 100 : null)
Why the multiplication with 100? Just let the developer set a value from 0 to 100. Otherwise it's confusing, because jpeg quality is not from 0 to 1, it's from 0 to 100.