You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Referring to the issue in the README, saving the image as JPEG will inevitably apply some level of compression. So decoding the image to retrieve the exact pixel intensities of the original image may not be possible unless using lossless formats like PNG
However, I found a little parameter of PIL save subsampling while doing the JPEG compression which tries to maintain the pixel intensity, still incurring some loss but not as big as without this parameter.
Referring to the issue in the README, saving the image as JPEG will inevitably apply some level of compression. So decoding the image to retrieve the exact pixel intensities of the original image may not be possible unless using lossless formats like PNG
However, I found a little parameter of PIL save
subsampling
while doing the JPEG compression which tries to maintain the pixel intensity, still incurring some loss but not as big as without this parameter.Given codebase without subsampling
Original implementation: https://github.com/ternaus/base64ToImageConverters/blob/main/image2base64/converters.py
Line number: 12
format: 'JPEG', quality=100
RGB Image:
Converted Image:
Mean difference of the assertion test: 125.74196689386562
With Subsampling parameter set to 0
RGB Image:
Converted Image:
Mean difference of the assertion test: 53.83414475819539
The visual as well as numerical difference in clear. JPEG will definitely lead to losses. But
subsampling=0
can preserve more details.The text was updated successfully, but these errors were encountered: