{"id":15399502,"url":"https://github.com/chai2010/webp","last_synced_at":"2025-05-15T13:08:42.695Z","repository":{"id":19134505,"uuid":"22364274","full_name":"chai2010/webp","owner":"chai2010","description":"WebP decoder and encoder for Go (Zero Dependencies).","archived":false,"fork":false,"pushed_at":"2025-04-06T02:38:19.000Z","size":6973,"stargazers_count":613,"open_issues_count":41,"forks_count":96,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-05-12T05:57:34.181Z","etag":null,"topics":["go","golang","image","webp"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chai2010.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2014-07-29T01:56:55.000Z","updated_at":"2025-05-09T15:19:23.000Z","dependencies_parsed_at":"2025-04-11T21:09:30.575Z","dependency_job_id":"9c921daf-5a3a-45d3-83ce-051cbfbdc283","html_url":"https://github.com/chai2010/webp","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chai2010%2Fwebp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chai2010%2Fwebp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chai2010%2Fwebp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chai2010%2Fwebp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chai2010","download_url":"https://codeload.github.com/chai2010/webp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254346624,"owners_count":22055808,"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":["go","golang","image","webp"],"created_at":"2024-10-01T15:49:10.359Z","updated_at":"2025-05-15T13:08:37.687Z","avatar_url":"https://github.com/chai2010.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"webp\r\n=====\r\n\r\n```\r\n██╗    ██╗███████╗██████╗ ██████╗\r\n██║    ██║██╔════╝██╔══██╗██╔══██╗\r\n██║ █╗ ██║█████╗  ██████╔╝██████╔╝\r\n██║███╗██║██╔══╝  ██╔══██╗██╔═══╝\r\n╚███╔███╔╝███████╗██████╔╝██║\r\n ╚══╝╚══╝ ╚══════╝╚═════╝ ╚═╝\r\n```\r\n\r\n\r\n[![Build Status](https://github.com/chai2010/webp/actions/workflows/test.yml/badge.svg)](https://github.com/chai2010/webp/actions/workflows/test.yml)\r\n[![GoDoc](https://godoc.org/github.com/chai2010/webp?status.svg)](https://pkg.go.dev/github.com/chai2010/webp)\r\n[![GitHub release](https://img.shields.io/github/v/tag/chai2010/webp.svg?label=release)](https://github.com/chai2010/webp/releases)\r\n[![license](https://img.shields.io/github/license/chai2010/webp.svg)](https://github.com/chai2010/webp/blob/master/LICENSE)\r\n\r\nBenchmark\r\n=========\r\n\r\n![](bench/benchmark_result.png)\r\n\r\n\r\nInstall\r\n=======\r\n\r\nInstall `GCC` or `MinGW` ([download here](http://tdm-gcc.tdragon.net/download)) at first,\r\nand then run these commands:\r\n\r\n1. `go get github.com/chai2010/webp`\r\n2. `go run hello.go`\r\n\r\n\r\nExample\r\n=======\r\n\r\nThis is a simple example:\r\n\r\n```Go\r\npackage main\r\n\r\nimport (\r\n\t\"bytes\"\r\n\t\"fmt\"\r\n\t\"io/ioutil\"\r\n\t\"log\"\r\n\r\n\t\"github.com/chai2010/webp\"\r\n)\r\n\r\nfunc main() {\r\n\tvar buf bytes.Buffer\r\n\tvar width, height int\r\n\tvar data []byte\r\n\tvar err error\r\n\r\n\t// Load file data\r\n\tif data, err = ioutil.ReadFile(\"./testdata/1_webp_ll.webp\"); err != nil {\r\n\t\tlog.Println(err)\r\n\t}\r\n\r\n\t// GetInfo\r\n\tif width, height, _, err = webp.GetInfo(data); err != nil {\r\n\t\tlog.Println(err)\r\n\t}\r\n\tfmt.Printf(\"width = %d, height = %d\\n\", width, height)\r\n\r\n\t// GetMetadata\r\n\tif metadata, err := webp.GetMetadata(data, \"ICCP\"); err != nil {\r\n\t\tfmt.Printf(\"Metadata: err = %v\\n\", err)\r\n\t} else {\r\n\t\tfmt.Printf(\"Metadata: %s\\n\", string(metadata))\r\n\t}\r\n\r\n\t// Decode webp\r\n\tm, err := webp.Decode(bytes.NewReader(data))\r\n\tif err != nil {\r\n\t\tlog.Println(err)\r\n\t}\r\n\r\n\t// Encode lossless webp\r\n\tif err = webp.Encode(\u0026buf, m, \u0026webp.Options{Lossless: true}); err != nil {\r\n\t\tlog.Println(err)\r\n\t}\r\n\tif err = ioutil.WriteFile(\"output.webp\", buf.Bytes(), 0666); err != nil {\r\n\t\tlog.Println(err)\r\n\t}\r\n    \r\n    fmt.Println(\"Save output.webp ok\")\r\n}\r\n```\r\n\r\nDecode and Encode as RGB format:\r\n\r\n```Go\r\nm, err := webp.DecodeRGB(data)\r\nif err != nil {\r\n\tlog.Fatal(err)\r\n}\r\n\r\ndata, err := webp.EncodeRGB(m)\r\nif err != nil {\r\n\tlog.Fatal(err)\r\n}\r\n```\r\n\r\nGive a Star! ⭐\r\n===============\r\n\r\nIf you like project, please give it a star. Thanks!\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchai2010%2Fwebp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchai2010%2Fwebp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchai2010%2Fwebp/lists"}