go-avif icon indicating copy to clipboard operation
go-avif copied to clipboard

Lossless isn't lossless

Open navjack opened this issue 6 years ago • 2 comments

Converting an image (png) to avif with lossless results in lost color information. There are less total colors in the image after the conversion process back to png.

The original PNG has 166,426 total colors The AVIF appears to have 52,720 total colors

The process I used to do this was

e:\avif-win-x64.exe -e "C:\Users\jackm\Downloads\materialball\material ball iray dimond material_rgb.png" -o "C:\Users\jackm\Downloads\materialball\material ball iray dimond material_rgb.avif" --lossless

and then

e:\avifdec.exe "C:\Users\jackm\Downloads\materialball\material ball iray dimond material_rgb.avif" "C:\Users\jackm\Downloads\materialball\material ball iray dimond material_rgb.y4m"

and then I used YUView to save the y4m file as a png in order for xnviewmp/irfanview to count the colors.

here are the files for you:

The Source Image: The Source Image

The AVIF as a PNG: The AVIF as a PNG

navjack avatar Aug 06 '19 02:08 navjack

That's probably due to RGB -> YCbCr 4:2:0 conversion step. I need to implement loading Y4M source files, that way you should have bit exact Y4M after decoding AVIF.

Kagami avatar Aug 06 '19 06:08 Kagami

Came here to report this issue. AVIF.io's lossless mode also isn't lossless. Only Paint.net is saving lossless properly so far.

bryc avatar Apr 20 '22 18:04 bryc