-
Notifications
You must be signed in to change notification settings - Fork 163
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
Add support for detecting avif files #160
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, sorry for the late response.
It seems like the sample image in this PR is a HEIF and not AVIF:
bash> file --mime avif.avif
image/heif; charset=binary
I was able to convert it to AVIF with:
bash> mv avif.avif heif.heif # move to .heif because convert uses extension to detect source file format.
bash> convert heif.heif avif.avif
@@ -42,6 +42,14 @@ var ( | |||
Xpm = prefix([]byte{0x2F, 0x2A, 0x20, 0x58, 0x50, 0x4D, 0x20, 0x2A, 0x2F}) | |||
) | |||
|
|||
func Avif(raw []byte, limit uint32) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AVIF format is using the FTYP container format so you can use the existing ftyp
function to create the detector. Like it's done for other FTYP formats in ftyp.go. The index where avif
should be searched for is 8:12, not 20:24.
Also, it seems like image/avif
should be returned for avif
(single image) and avis
(image sequence): reference
Hey @gabriel-vasile, I pulled the sample image from this page, which is supposed to be a list of sample AVIF images used by netflix. (I used this one I believe). I did find some more avif samples here which do show the ftyp you describe here:
vs the netflix one:
So I am a bit confused now 😕 |
This is tricky. some references: |
According to libvips/libvips#1657 |
Considering |
Closing this in favor of #210. |
I took a stab at implementing this. Let me know if it needs more work 😃