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

Accessing image metadata without decoding #35

Closed
AurelC2G opened this issue Dec 11, 2019 · 2 comments
Closed

Accessing image metadata without decoding #35

AurelC2G opened this issue Dec 11, 2019 · 2 comments

Comments

@AurelC2G
Copy link
Contributor

AurelC2G commented Dec 11, 2019

Right now, it is necessary to call avifDecoderRead prior to reading anything from the avifImage. However, there are cases when we may want to read some of the image's metadata without actually decoding the image data itself (pixel values). Such metadata includes:

  • image dimensions
  • depth
  • color profile
  • exif / xmp metadata
  • potentially, whether there is an alpha plane

Could we add an api to make this possible? Ideally we would expose as much as we can without requiring anything from the codec.

@joedrago
Copy link
Collaborator

This path exists already. See the decoding sample in the readme which calls avifDecoderParse().

@joedrago
Copy link
Collaborator

I should clarify:

avifDecoderParse() is the function you are looking for, and it populates a bunch of members in avifDecoder prefixed with "container", which include the width, height, and depth. XMP and EXIF are also available after this call.

There is no guarantee that these values match the actual decoded image (if someone were being malicious), but they will be correct most of the time, and if they ever mismatch you can consider it an error.

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