{"id":21648257,"url":"https://github.com/sapphi-red/midec","last_synced_at":"2025-03-20T01:59:14.305Z","repository":{"id":51125578,"uuid":"354634362","full_name":"sapphi-red/midec","owner":"sapphi-red","description":"Pure go multi-image detector. cf. Animated GIF, APNG, Animated WebP, Animated HEIF/AVIF.","archived":false,"fork":false,"pushed_at":"2021-05-22T12:33:41.000Z","size":266,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-25T05:11:40.710Z","etag":null,"topics":["apng","avif","golang","heif","png","webp"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sapphi-red.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-04T19:55:55.000Z","updated_at":"2022-04-22T07:52:01.000Z","dependencies_parsed_at":"2022-09-26T19:01:49.802Z","dependency_job_id":null,"html_url":"https://github.com/sapphi-red/midec","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sapphi-red%2Fmidec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sapphi-red%2Fmidec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sapphi-red%2Fmidec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sapphi-red%2Fmidec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sapphi-red","download_url":"https://codeload.github.com/sapphi-red/midec/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244536437,"owners_count":20468349,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apng","avif","golang","heif","png","webp"],"created_at":"2024-11-25T06:54:19.757Z","updated_at":"2025-03-20T01:59:14.285Z","avatar_url":"https://github.com/sapphi-red.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# midec [![Go Reference](https://pkg.go.dev/badge/github.com/sapphi-red/midec.svg)](https://pkg.go.dev/github.com/sapphi-red/midec) [![CI](https://github.com/sapphi-red/midec/actions/workflows/main.yaml/badge.svg)](https://github.com/sapphi-red/midec/actions/workflows/main.yaml) [![codecov](https://codecov.io/gh/sapphi-red/midec/branch/main/graph/badge.svg?token=H9T7BGUQ7V)](https://codecov.io/gh/sapphi-red/midec)\n\nPure go **m**ulti-**i**mage **de**te**c**tor.\ncf. Animated GIF, APNG, Animated WebP, Animated HEIF / AVIF.\n\nChecks whether the image is a multi-image(animated image).\n\n## Usage\n```go\npackage main \n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/sapphi-red/midec\"\n\t_ \"github.com/sapphi-red/midec/gif\" // import this to detect Animated GIF\n\t// _ \"github.com/sapphi-red/midec/png\" // import this to detect APNG\n\t// _ \"github.com/sapphi-red/midec/webp\" // import this to detect Animated WebP\n\t// _ \"github.com/sapphi-red/midec/isobmff\" // import this to detect Animated HEIF / AVIF\n)\n\nfunc main() {\n\tfp, err := os.Open(\"test.gif\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tisAnimated := midec.IsAnimated(fp)\n\tfmt.Println(isAnimated)\n}\n```\n\n## Extension\nTo add support for other formats, use `midec.RegisterFormat`.\nThis function is very similar to [`image.RegisterFormat`](https://golang.org/pkg/image/#RegisterFormat).\n\n```go\nfunc init() {\n\tmidec.RegisterFormat(\"gif\", gifHeader, isAnimated)\n}\n```\n\n## Benchmarks\nComparison with using `image/gif` package's `gif.decodeAll`. See code for [`bench_test.go`](https://github.com/sapphi-red/midec/blob/main/bench_test.go).\n```text\ngoos: windows\ngoarch: amd64\npkg: github.com/sapphi-red/midec\ncpu: AMD Ryzen 7 3700X 8-Core Processor\nBenchmarkGIF_ImageGIF-16            2581            443108 ns/op          497567 B/op            1435 allocs/op\nBenchmarkGIF_Midec-16             157585              7568 ns/op            5008 B/op              36 allocs/op\nBenchmarkPNG_Midec-16             265256              4811 ns/op            5008 B/op              13 allocs/op\nBenchmarkWebP_Midec-16            181000              6667 ns/op            5040 B/op              20 allocs/op\nBenchmarkHEIFAVIF_Midec-16        188468              5967 ns/op            5136 B/op              44 allocs/op\nPASS\nok      github.com/sapphi-red/midec     23.147s\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsapphi-red%2Fmidec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsapphi-red%2Fmidec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsapphi-red%2Fmidec/lists"}