bimg
bimg copied to clipboard
png not compressing (quality) and it's size is increasing
code sample:
options := bimg.Options{
Quality: quality,
Lossless: true,
}
newImage := imgBuf.Bytes()
newImage, err = bimg.NewImage(imgBuf.Bytes()).Process(options)
image is jpeg by default.
the image:

What's the expectation here? PNG is a lossless format and optimized for computer graphics, not photos. JPEG achieves its smaller size due to its lossy compression. So I don't see how the PNG could be smaller than the JPEG, even at high (lossless!) compression.
IMO the only way out would be to use a lossy compression (imagequant does that for example), but that more or less destroys the advantage of PNG.