mirror of
https://github.com/talgo-cloud/talgo-libwebp.git
synced 2026-03-09 07:28:20 -07:00
initial commit
This commit is contained in:
commit
5af6d93b3b
26 changed files with 1165 additions and 0 deletions
22
examples/decode/decode.go
Normal file
22
examples/decode/decode.go
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/harukasan/go-libwebp/examples/util"
|
||||
"github.com/harukasan/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")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue