Kagami / go-avif

:art: Go AVIF library
Creative Commons Zero v1.0 Universal
320 stars 20 forks source link

Lossless isn't lossless #6

Open navjack opened 5 years ago

navjack commented 5 years ago

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

Kagami commented 5 years ago

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.

bryc commented 2 years ago

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