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

Accept file signature b"ftypmif1" #5

Closed
cosine0 opened this issue Oct 4, 2021 · 3 comments
Closed

Accept file signature b"ftypmif1" #5

cosine0 opened this issue Oct 4, 2021 · 3 comments

Comments

@cosine0
Copy link

cosine0 commented Oct 4, 2021

Some files use b"ftypmif1" as signatures. But they are not accepted by the _accept function. Please add this to the signature list.

@fdintino
Copy link
Owner

fdintino commented Oct 4, 2021

I believe that is a signature used by HEIF images. Could you provide an example AVIF image with that brand in the ftyp box?

@cosine0
Copy link
Author

cosine0 commented Oct 5, 2021

According to the AVIF specification draft, HEIF is a container and AVIF is a HEIF file that contains image data. AVIF can be specified by using b'avif' either as the major brand at byte 8-11 following b'ftyp' or as one of the compatible brands starting from byte 16, using b'mif1' as the major brand.

One example using b'mif1' as the major brand is AVIF sample image set provided by Netflix. Relatively new files seem using b'avif'.

I think we need to check additionally for compatible brands to safely accept b'mif1'-AVIF files.

@fdintino
Copy link
Owner

Those netflix images don't appear to be valid...aomdec and avifdec both give parsing errors. Still, I can accept a broader range of major brands and let the libavif decoder raise the appropriate error if it's not a valid AVIF file. Pillow will fail over to other decoders if they're available so we don't need to worry about trumping another plugin (one for HEIC, for instance).

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

2 participants