Closed FurkanGozukara closed 11 months ago
https://github.com/libjpeg-turbo/libjpeg-turbo/blob/main/usage.txt
For most images, specifying a quality value above about 95 will increase the size of the compressed file dramatically, and while the quality gain from these higher quality values is measurable (using metrics such as PSNR or SSIM), it is rarely perceivable by human vision.
So no other side effect?
We might adjust the buffer size, but otherwise, this is actually a question about how libjpeg behaves.
Looking through https://github.com/libjpeg-turbo/libjpeg-turbo/blob/main/usage.txt,
-quality 100 will generate a quantization table of all 1's, minimizing loss in the quantization step (but there is still information loss in subsampling, as well as roundoff error.)
can you tell me in simple terms this?
I am using this to train Stable Diffusion model
will 100% quality cause any issues compared to 95%?
My first comment was saying that quality above 95 is unlikely to make an improved that is perceptible to humans.
Adjusting the buffer size shouldn't have any effect on the output, it is just an internal difference to allow the image to save correctly.
Really, if you are concerned about quality, I would suggest you save images as PNGs instead, since PNG is a lossless format, and JPEG is lossy - meaning that JPEGs may not save images with the exact same pixels that were in your image.
I know and I am agree. but original images are JPEG so i am not sure if saving as PNG will bring any improvement
Opening a JPEG and saving it as a PNG will not make the image better than the original, no. But opening a JPEG and saving it as a JPEG again can make it look worse than the original.
https://imagekit.io/blog/jpeg-image-degradation/
while JPEG has provided us with several benefits like reduced file sizes, faster transmission, storage efficiency, and the like, it has also introduced a new problem — JPEG degradation. This term describes the loss of image quality that occurs when a JPEG image is edited and/or re-saved
@FurkanGozukara did you have any further questions?
thank you
Here your documentation says this
https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html#jpeg-saving
Why avoid 95+ any particular reason?
I am ok with speed and size when I set it 100