Address out of order compatibility brands in Filetypebox of heif files#401
Address out of order compatibility brands in Filetypebox of heif files#401OliverSpeir wants to merge 1 commit intoimage-size:mainfrom
Conversation
netroy
left a comment
There was a problem hiding this comment.
Thanks for this. Can we please add test images to assert these fixes, and to prevent any regressions in the future 🙏🏽
|
|
what I've done in order to achieve the tests is somewhat hacky, I'll admit. I didn't know how to generate the actual images that would correspond to these conditions, so I manually edited the type boxes of a .avif version of sample.png I created with sharp. The way I discovered this condition is from an image in astro's tests. Here's the original image and I looked at how this images type box was structured and recreated it. All of the test files I added have a very similiar structure, the only difference is to test each condition I changed the second brand. They all are structured like this:
@netroy Hopefully this makes sense and is viable in your opinion I am happy to rework / make any changes you'd like. Thank you |
|
I've been trying to find a way to create these images properly using a reliable tool. but no luck so far, as no tool lets us define the brands. The manually edited files look okay at a first glance, but the BTW, I've rebased this on the |
I will try to do the same, I am not too shocked to hear this didn't work I wish I could figure out how the original light_walrus.avif was created, but I'll try to also do some research we can also use |
Some HEIF-based files use a generic major brand like `mif1` but include the actual format type (avif, heic, etc.) in their compatibility brands. This change scans the full ftyp box to correctly identify the format. Also adds `avis` brand for AVIF sequences.
|
|
|
||
| const brandMap = { | ||
| avif: 'avif', | ||
| avis: 'avif', // avif-sequence |
There was a problem hiding this comment.
also adds this in here - it was added in withastro/astro#14045 successfully






Changes
/lib/types/heif.tsheif.tsrelies on the first brand in the FileTypeBox, but for example some .avif images do not have "avif" as the first type in their FileTypeBox2. Sets node version in package.json to18.4which shouldn't cause any problems as far as I am awareavisto the brand map