jpeg-python icon indicating copy to clipboard operation
jpeg-python copied to clipboard

how to adjust compression ratio?and why the decode image after encode will appear some white points, why?

Open maliho0803 opened this issue 4 years ago • 4 comments

how to adjust compression ratio?and why the decode image after encode will appear some white points, why? image

image

maliho0803 avatar Sep 29 '19 07:09 maliho0803

@maliho0803 it is because dct/idct cant get exact same result, and some rgb vlaue become around (-10,0), moreover if using ycbcr color space, it will be more easy to get such value around (-5,0), transfering them to unit8 will make them become (245,255) so you see the white points

timmmGZ avatar Mar 25 '20 18:03 timmmGZ

how to adjust compression ratio?

ZJU-XWK avatar Jan 14 '21 11:01 ZJU-XWK

@xwk111 I think one way could be adjusting quantization table. Bigger values would enable more rough quantization, which results in smaller data size. You can easiliy test with changing arrays after initialization in load_quantization_table function in utils.py.

seonjunn avatar Oct 10 '21 09:10 seonjunn

@timmmGZ Would you plz explain more about white points? I understood that idct after dct can make different result. But I have few questions.

  1. Why YCbCr color space is more vulnerable to get value around (-5,0) ?
  2. Could you specify the code where transfer from small negative values ( (-10,0) or (-5,0) ) to uint8 making (245,255)?

seonjunn avatar Oct 10 '21 09:10 seonjunn