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

Add support for .avif file format #151

Closed
gabriel-vasile opened this issue Apr 19, 2021 · 3 comments
Closed

Add support for .avif file format #151

gabriel-vasile opened this issue Apr 19, 2021 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@gabriel-vasile
Copy link
Owner

  1. Specify the MIME type and extension for which to add support
    image/avif .avif
  2. Share an example file
    ...
  3. Optionally, add a reference to the specification of the file format.
    https://www.iana.org/assignments/media-types/image/avif
    https://en.wikipedia.org/wiki/AV1#AV1_Image_File_Format_(AVIF)
@gabriel-vasile gabriel-vasile added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Apr 19, 2021
@vansante
Copy link
Contributor

I took a stab at this: #160

@mhf-ir
Copy link

mhf-ir commented Jan 6, 2022

it's wrong result:

package main

import (
	"fmt"

	"github.com/gabriel-vasile/mimetype"
)

func main() {

	files := []string{
		"testdata/avif.avif", // application/octet-stream
		"testdata/avifsequence.avif", // application/octet-stream
	}

	for _, p := range files {
		mtype, _ := mimetype.DetectFile(p)
		fmt.Println(mtype.String())
	}

}
sweb@sweb-laptop:/sweb/projects/sample$ cat go.sum 
github.com/gabriel-vasile/mimetype v1.4.0 h1:Cn9dkdYsMIu56tGho+fqzh7XmvY2YyGU0FnbhiOsEro=
github.com/gabriel-vasile/mimetype v1.4.0/go.mod h1:fA8fi6KUiG7MgQQ+mEWotXoEOvmxRtOJlERCzSmRvr8=
golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220105145211-5b0dc2dfae98 h1:+6WJMRLHlD7X7frgp7TUZ36RnQzSf9wVVTNakEp+nqY=
golang.org/x/net v0.0.0-20220105145211-5b0dc2dfae98/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
sweb@sweb-laptop:/sweb/projects/sample$ cat go.mod 
module github.com/org/sample

go 1.17

require (
        github.com/gabriel-vasile/mimetype v1.4.0 // indirect
        golang.org/x/net v0.0.0-20220105145211-5b0dc2dfae98 // indirect
)
sweb@sweb-laptop:/sweb/projects/sample$ 

Env:

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 21.10
Release:	21.10
Codename:	impish
$ go version
go version go1.17.1 linux/amd64

@gabriel-vasile
Copy link
Owner Author

Hi @mhf-ir
.avif support was added in #210, but it is not yet released.
You can wait for the new release or update manually to the latest commit:

go get github.com/gabriel-vasile/mimetype@db2464c28aec

I'm going to close this issue but feel free to open a new one if it's still not detecting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants