Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brightness (colors) of AVIF file depends on viewer application #40

Open
darkcharmander opened this issue Aug 6, 2020 · 6 comments
Open

Comments

@darkcharmander
Copy link

darkcharmander commented Aug 6, 2020

There is something strange going on here! I don't know whether the problem lies in cavif, but maybe someone can shed some light on this:

The problem is that the brightness of the AVIF files seem to change depending on what viewer you use for them.
I will sketch out the scenario that I have. I have converted a sample image via https://convertio.co (We'll call it 'internet' in the scenarios as source) as test image to compare against cavif. This is what happens:

Viewer: Firefox

Original: Normal
Cavif: Too bright
Internet: Normal

Viewer: nomacs or xnviewmp

Original: Normal
Cavif: Normal
Internet: Too bright

I think that in either the AVIF container something is wrong, or in the decoder that is used. Before I convert a ton of images to AVIF, I would like to know what is causing this. I don't want to convert everything and then discover that the colors are messed up in some places. If it's a decoder issue, then which decoder is wrong here? Firefox or nomacs? Given that the internet file and cavif file both look different depending on the application that is used.

For your convenience, I attached the demo images to this post. They are royalty free and taken from https://www.pexels.com/nl-nl/foto/dier-schattig-boerderij-gras-4321311/, so yes, this is perfectly legal. (I had to zip them because GitHub doesn't 'support' AVIF files.)
Demo files: cavif-image-brightness-sample.zip

I've used a couple of different commands to convert the image to AVIF with Cavif, but they all yield the same result. Here is one of the commands that I've used: cavif --rate-control q --crf 10 --row-mt --tile-rows 2 --tile-columns 2 --color-primaries bt2020 --transfer-characteristics bt2020 --enable-full-color-range -i original.png -o out.avif

If you do not enable BT.2020, it seems you can lose colors sometimes. I therefore always enable it.

@G2G2G2G
Copy link
Contributor

G2G2G2G commented Feb 25, 2021

firefox currently has a bug where all AVIF appear to be darker, even if they're lossless. It's the same for all encoders (gimp as well) it is a firefox issue. No idea about the others.

@TianyiShi2001
Copy link

I agree that it's probably the problem of Firefox. Viewing on chrome seems normal.

@baumanj
Copy link

baumanj commented Apr 6, 2021

Firefox AVIF dev here:

out-cavif.avif from the attached demo archive is full range, BT.2020 primaries, BT.2020 10-bit transfer function, identity matrix.

out-internet.avif is limited range and primaries, transfer function and matrix are all "unspecified", which defaults to BT.709 per MIAF.

With regards to Firefox's rendering of the first there are two issues:

  1. AVIF files tagged with full range are decoded as limited range
  2. AVIF support for 10-bit or 12-bit channels (full pipeline support is a bigger issue, but this issue is for tone-mapping, so that things look more correct when putting 10-bit into a 8-bit space)

The full-range issue should hopefully be addressed soon, the tonemapping is likely to take longer. In the meantime, you should get better results using bt709 and/or limited range.

@darkcharmander
Copy link
Author

@baumanj Thanks for you comment!

I've abandoned AVIF for quite some time now, because Linux and iOS support is still non-existent. I want AVIF to work on these platforms too before I make a full shift. JPEG XL has also arrived now, so it's all getting more heated up.

I made a post on Reddit, and essentially asked the same question as here: AVIF images color loss/change

You can view the post by heading to the link. I tested several scenarios, and the best settings for AVIF seem to be (YUV444, full) --cicp 1/13/1, which I've (admbot is my name there) also posted with an explanation as to why it is the best setting. I hope that things improve...

@G2G2G2G
Copy link
Contributor

G2G2G2G commented Apr 7, 2021

@darkcharmander Linux "support is still non-existent" uhh I wouldn't go that far... what are you calling "support"? thumbnails work by default for over a year on several distros file managers (thunar, nemo, etc)... Windows requires an extension for it to work, which is provided on the windows store. No idea about iOS or OS X, they're pretty irrelevant, but I know they love HEIC.

@baumanj
Copy link

baumanj commented Apr 7, 2021

Apple hasn't released any information about their plans for official iOS or macOS support, but there is https://github.com/dreampiggy/AVIFQuickLook, which I've found useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants