Comments (10)
If I understood Rick's upvote I should sing my song here instead. Here goes:
Version
- Windows 10
- paint.net 5.0.12 (Stable 5.12.8735.38135)
- Google Chrome Version 121.0.6167.140 (Officiel version) (64-bit)
- Firefox 122.0 (64-bit)
- AvifFileType v1.1.27.0
- AOM v3.7.1-664-g94fe92f0ed
Bug
paint.net will at times generate avif images which does not conform to the standard. I have not been able to track down when/why. Saving a series of 10 avif files in different resolutions caused problems with 4.
The images can be reopened with paint.net and displayed in Chrome but fails in Firefox.
Firefox has previously been reluctant to address avif issues if they where non-conforming:
https://bugzilla.mozilla.org/show_bug.cgi?id=1700723
The check is done using:
https://gpac.github.io/ComplianceWarden-wasm/index.html
The 4 offending images has no direct errors but they all give multiple warnings on rule #38.
[miaf][Rule #38] Warning: Tile widths should be a multiple of 64. Found XXX
Specification description: MIAF (Multi-Image Application Format)
MPEG-A part 22 - ISO/IEC 23000-22 - w18260 FDIS - Jan 2019
[miaf][Rule #38] Section 7.3.11.4.2
Any grid image in a MIAF file shall also conform to the following constraints:
- The tile_width shall be greater than or equal to 64, and should be a multiple
of 64.
- The tile_height shall be greater than or equal to 64, and should be a multiple
of 64.
The offending images are downscaled versions of the same source image. When saving "Preserve Exisiting Tile Size" was enabled.
It is worth noting that these are warnings and not errors. It might be worth pursuing a bug with Firefox as well but I think it is important to get your stance on this. This might be a more general aom issue or for 0xC0000054 but I have no clue. It is part of the default install so now I start here.
I am unsure if it is a tile issue or that is just a red herring. One offender is attached radio1920x908.avif and I have more samples available at request. This file will fail in Firefox but work in Chrome and Paint.NET.
The sob story
I made a HTML file with this image stack:
<img src="img/radio1920x908.png"
alt=""
srcset="img/radio5604x2650.avif 5604w,
img/radio5120x2421.avif 5120w,
img/radio4096x1937.avif 4096w,
img/radio3840x1816.avif 3840w,
img/radio2560x1211.avif 2560w,
img/radio2048x968.avif 2048w,
img/radio1920x908.avif 1920w,
img/radio1920x908.png 1920w,
img/radio1280x605.avif 1280w,
img/radio1280x605.png 1280w,
img/radio640x303.avif 640w,
img/radio640x303.png 640w,
img/radio320x151.avif 320w,
img/radio320x151.png 320w"
sizes="100vw">
It worked as expected in Chrome. But in Firefox it blanked out for 1920w, 2048w, 3840w and 5604w. In developer tools it looked like the correct versions downloaded properly. The remaining images in the srcset was picked up and displayed properly. The images opened nicely in Paint.NET which I use for images (duh!). Many (many!!!!) hours of trials, debugging and troubleshooting later I finally tried to open the offending images directly in Firefox (right-click open with) and got the error:
The image [image] cannot be displayed because it contains errors.
The weird thing is that 5604w is an offender as that was the base image and the rest are simply resized versions of that (tiles preserved!). It started as a JPEG and I trimmed the size and removed the background. Then I did the monkey work of resize -> save as avif -> save as png -> repeat x9.
The avif settings was the same each time:
Quality: 43
[ ] Lossless
[X] Lossless Alpha Compression
Encoder preset: Medium
Chroma 4:2:0
[X] Preserve Exisiting Tile Size
[X] Premultiplied Alpha
I do not have steps to reproduce as such. But I suspect if I save enough images then some will fail in Firefox. If need be I will take the time to do that.
Let me know if I am missing something obvious? Anything else you want me to do etc.?
Thank you for your time!
Kind Regards
Claus Andersen
from pdn-avif.
NOTE: I now see there is a later version than the one bundled with Paint.NET. I have not tried that yet as I have no surefire way of reproducing.
from pdn-avif.
Yay! I can reproduce!
I updated the plugin with the latest release.
In the save as dialog in confirms as version 1.1.30 AOM 3.8.1
I did a resize to 1920x908 and could not open in Firefox
I did a resize to 1280x605 and could open in Firefox.
The 1280 was clean in Compliance Warden and the 1920 has warnings:
[miaf][Rule #38] Warning: Tile heights should be a multiple of 64. Found 908
[miaf][Rule #38] Warning: Tile heights should be a multiple of 64. Found 908
[miaf][Rule #38] Warning: Tile heights should be a multiple of 64. Found 908
[miaf][Rule #38] Warning: Tile heights should be a multiple of 64. Found 908
So it would seem that there is some sort of correlation to size.
from pdn-avif.
It gets better:
- Open Paint.NET with a blank canvas
- Resize to 1920x908
- Save as avif
Fails to open in Firefox.
Compliance Warden warns:
[miaf][Rule #38] Warning: Tile heights should be a multiple of 64. Found 908
[miaf][Rule #38] Warning: Tile heights should be a multiple of 64. Found 908
Details:
Version 1.1.30 AOM 3.8.1
Quality: 43
[ ] Lossless
[X] Lossless Alpha Compression
Encoder preset: Medium
Chroma 4:2:0
[X] Preserve Exisiting Tile Size
[X] Premultiplied Alpha
from pdn-avif.
This is a duplicate of issue #23.
The problem is that Firefox does not support tiled images. See https://bugzilla.mozilla.org/show_bug.cgi?id=1696090.
The Compliance Warden warnings are related to a recommendation in the MAIF standard that the individual images in a tiled image should have a width and height that is a multiple of 64, but few (if any) AVIF encoders bother to follow that.
The library that chrome uses for AVIF decoding (libavif), also ignores that recommendation:
// The priority could be to use a cell size that is a multiple of 64, but there is not always a valid one,
// even though it is recommended by MIAF. Just use ceil(numPixels/numCells) for simplicity and to avoid
// as much padding in the right-most and bottom-most cells as possible.
AOMediaCodec/libavif@454adbf/apps/avifenc.c#L533
from pdn-avif.
I am such an idiot. I only searched the open issues. Sorry!!!
I am a little puzzled as 1280x605 is not a mutipla of 64 either but that works?
So this leaves us between a rock and a hard place. You (more precisely aom) does not want to follow the spec to the letter and Firefox will only care if you are strict.
I will try to complain to Firefox and see if they at least can change the horrible UX so the images are not dropped silently. At least they could log it in the console.
from pdn-avif.
I am a little puzzled as 1280x605 is not a mutipla of 64 either but that works?
If you are saving on the Medium, Slow or Very Slow presets, the plugin will not use tiles for that image.
The Fast, Medium and Slow presets use progressively larger tile sizes. Very Slow does not use tiles at all, but it can take ages to save because of that.
So this leaves us between a rock and a hard place. You (more precisely aom) does not want to follow the spec to the letter and Firefox will only care if you are strict.
It is Firefox that is not following the spec, by their AVIF decoder not supporting tiled/grid images. As I mentioned above the MAIF recommendation that tile/grid images should be a multiple of 64 is effectively ignored by most AVIF decoders and encoders.
Here are 3 tiled/grid images from the official AVIF test suite: Summer_in_Tomsk_720p_5x4_grid.avif, animals_00_multilayer_grid_a1lx.avif and animals_00_multilayer_grid_lsel.avif..
Summer_in_Tomsk_720p_5x4_grid.avif uses tiles that are not multiple of 64, but the other two images do. Firefox can't open any of them.
from pdn-avif.
A workaround would then be to always spend the time and save using the "Very slow" preset if I understand correctly. That is interesting to know as I usually only see a size difference between fast and medium and have stopped testing the slower ones.
All images I have put through sqoosh.app does not suffer from this problem. But the workflow will be easier without going that route.
Do you happen to know if there are any other known major pitfalls with the Firefox decoder? Is it a lost cause?
Again, thank you for your time and effort in this project. It is highly appreciated. I'll bugger off again ;-)
from pdn-avif.
All images I have put through sqoosh.app does not suffer from this problem. But the workflow will be easier without going that route.
Another option would be to use libavif's avifenc command line app,
Do you happen to know if there are any other known major pitfalls with the Firefox decoder?
The grid issue is the main bug I am aware of. Firefox's general tracking issue for AVIF support is: https://bugzilla.mozilla.org/show_bug.cgi?id=1443863
from pdn-avif.
Brilliant, thanks!
from pdn-avif.
Related Issues (20)
- Update readme after bundling HOT 2
- Use IAvifFileTypeString for loading strings
- Add Forum Discussion and GitHub links to the UI
- Consider changing default compression speed to 'Fast' HOT 1
- Saving at 100% quality produces corrupted colors (in some other apps) HOT 8
- Label for Quality is in the wrong place
- Access Violation in CompressImage() (v1.0.5.0) HOT 7
- Error when saving file with 4:4:4 Chrome Subsampling, 4:2:2 went OK. pdn-avif v1.1.0
- Support cancellation when saving HOT 6
- Any chance you could create a nuget package just for loading and saving avif images? HOT 1
- ARM64 build of native dll? HOT 3
- Crash / failure with latest version bundled with PDN 4.2.15
- Very large AVIF saving is unresponsive HOT 2
- Investigate changing the compression quality behavior to match libavif and libheif
- Paint.net 5 - preview of the file size for avif file - wrong calculation (preview e.g. 170 KB - saved file 189 KB) HOT 1
- AVIF file - incompatible with Android 12 or newer HOT 1
- Created AVIF files don't display in Firefox HOT 3
- Allow the Fast, Medium and Slow presets to disable the automatic image grid (tiling) HOT 4
- Plugin requires Core 7 - why? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pdn-avif.