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

Metadata for AVIF, format returned as 'heif' #2504

Closed
tomgallagher opened this issue Dec 30, 2020 · 8 comments
Closed

Metadata for AVIF, format returned as 'heif' #2504

tomgallagher opened this issue Dec 30, 2020 · 8 comments

Comments

@tomgallagher
Copy link

tomgallagher commented Dec 30, 2020

Using Sharp 27, which now supports AVIF and is great. Thanks!

Downloading this image and then extracting metadata with sharp(inputavif).metadata()

http://download.opencontent.netflix.com.s3.amazonaws.com/AV1/Chimera/AVIF/Chimera-AV1-10bit-1280x720-2380kbps-100.avif

The format returned is heif as that's the encoder used by libvips.

Is it true that this metadata format will be returned for both avif and heic images?

If so, it's not going to be possible to use the metadata to distinguish between the two, one of which is patent-encumbered and cannot be processed without globally installed libvips, as I understand it.

Would it be possible for the libvips metadata to return avif as the format, for consistency with mime type headers and Sharp output format strings?

@lovell
Copy link
Owner

lovell commented Dec 30, 2020

libvips v8.11.0 will contain logic to expose the heif-compression metadata - see libvips/libvips#1850

@tomgallagher
Copy link
Author

Not sure if this is related, but metadata throws error for this animated avif image

https://colinbendell.github.io/webperf/animated-gif-decode/2.avif

I'm guessing not supported at the moment.

@lovell
Copy link
Owner

lovell commented Dec 31, 2020

$ hexdump -C 2.avif | head -1
00000000  00 00 00 20 66 74 79 70  61 76 69 73 00 00 00 00  |... ftypavis....|

Please see strukturag/libheif#377

@lovell
Copy link
Owner

lovell commented Aug 17, 2021

v0.29.0 now available.

@lovell lovell closed this as completed Aug 17, 2021
@adityapatadia
Copy link

When we use https://sharp.pixelplumbing.com/api-output#tobuffer with resolveWithObject, it does not return the new compression property.

@lovell
Copy link
Owner

lovell commented Aug 18, 2021

@adityapatadia This issue relates to the metadata() function - please see d000f57#diff-7593ef01ed4401c670c4acf3cc96c2fbaee20979169fb66f81dddb45b91ec132 for a usage example.

@adityapatadia
Copy link

Yes, but ideally resolveWithObject should also return same data as metadata(). For example, when an image is compressed inside a function, its return info should ideally have all info about how was the image encoded.

@lovell
Copy link
Owner

lovell commented Aug 18, 2021

The object returned/resolved by toBuffer() contains properties that are calculated or might change during processing. The compression property of avif() is known before processing and does not change during.

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

No branches or pull requests

3 participants