talgo-libwebp/examples/decode/decode.go
Rohan Singh dd1cead28d Fork and add module
The upstream harukasan/go-libwebp hasn't been updated in almost three
years, so we're officially forking this into tidbyt/go-libwebp and
making it a Go module.
2022-03-01 22:33:50 -05:00

23 lines
425 B
Go

// Package main is an example implementation of WebP decoder.
package main
import (
"github.com/tidbyt/go-libwebp/test/util"
"github.com/tidbyt/go-libwebp/webp"
)
func main() {
var err error
// Read binary data
data := util.ReadFile("cosmos.webp")
// Decode
options := &webp.DecoderOptions{}
img, err := webp.DecodeRGBA(data, options)
if err != nil {
panic(err)
}
util.WritePNG(img, "encoded_cosmos.png")
}