We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
按照文档的方式写了示例代码: package main
import ( "bytes" "fmt" "io/ioutil" "log"
"github.com/chai2010/webp"
)
func main() { var buf bytes.Buffer var width, height int var data []byte var err error
// Load file data if data, err = ioutil.ReadFile("./testdata/1_webp_ll.webp"); err != nil { log.Println(err) } // GetInfo if width, height, _, err = webp.GetInfo(data); err != nil { log.Println(err) } fmt.Printf("width = %d, height = %d\n", width, height) // GetMetadata if metadata, err := webp.GetMetadata(data, "ICCP"); err != nil { fmt.Printf("Metadata: err = %v\n", err) } else { fmt.Printf("Metadata: %s\n", string(metadata)) } // Decode webp m, err := webp.Decode(bytes.NewReader(data)) if err != nil { log.Println(err) } // Encode lossless webp if err = webp.Encode(&buf, m, &webp.Options{Lossless: true}); err != nil { log.Println(err) } if err = ioutil.WriteFile("output.webp", buf.Bytes(), 0666); err != nil { log.Println(err) } fmt.Println("Save output.webp ok")
}
go.mod中: module test_prj
go 1.20
require ( github.com/chai2010/webp v1.1.1 )
go run 的时候报错:
/root/go/pkg/mod/github.com/chai2010/[email protected]/webp.go:22:9: undefined: webpGetInfo /root/go/pkg/mod/github.com/chai2010/[email protected]/webp.go:26:20: undefined: webpDecodeGray /root/go/pkg/mod/github.com/chai2010/[email protected]/webp.go:39:20: undefined: webpDecodeRGB /root/go/pkg/mod/github.com/chai2010/[email protected]/webp.go:52:20: undefined: webpDecodeRGBA /root/go/pkg/mod/github.com/chai2010/[email protected]/webp.go:68:14: undefined: webpDecodeGrayToSize /root/go/pkg/mod/github.com/chai2010/[email protected]/webp.go:82:14: undefined: webpDecodeRGBToSize /root/go/pkg/mod/github.com/chai2010/[email protected]/webp.go:96:14: undefined: webpDecodeRGBAToSize /root/go/pkg/mod/github.com/chai2010/[email protected]/webp.go:109:7: undefined: toGrayImage /root/go/pkg/mod/github.com/chai2010/[email protected]/webp.go:110:14: undefined: webpEncodeGray /root/go/pkg/mod/github.com/chai2010/[email protected]/webp.go:119:14: undefined: webpEncodeRGB /root/go/pkg/mod/github.com/chai2010/[email protected]/webp.go:119:14: too many errors
golang版本: go version go1.20.14 linux/amd64
The text was updated successfully, but these errors were encountered:
我也出现了
Sorry, something went wrong.
这个问题请问下解决了吗 我也遇到了
CGO的环境变量被禁止了吧 go env -w CGO_ENABLED=1
it works CGO_ENABLED=1 ?
No branches or pull requests
按照文档的方式写了示例代码:
package main
import (
"bytes"
"fmt"
"io/ioutil"
"log"
)
func main() {
var buf bytes.Buffer
var width, height int
var data []byte
var err error
}
go.mod中:
module test_prj
go 1.20
require (
github.com/chai2010/webp v1.1.1
)
go run 的时候报错:
github.com/chai2010/webp
/root/go/pkg/mod/github.com/chai2010/[email protected]/webp.go:22:9: undefined: webpGetInfo
/root/go/pkg/mod/github.com/chai2010/[email protected]/webp.go:26:20: undefined: webpDecodeGray
/root/go/pkg/mod/github.com/chai2010/[email protected]/webp.go:39:20: undefined: webpDecodeRGB
/root/go/pkg/mod/github.com/chai2010/[email protected]/webp.go:52:20: undefined: webpDecodeRGBA
/root/go/pkg/mod/github.com/chai2010/[email protected]/webp.go:68:14: undefined: webpDecodeGrayToSize
/root/go/pkg/mod/github.com/chai2010/[email protected]/webp.go:82:14: undefined: webpDecodeRGBToSize
/root/go/pkg/mod/github.com/chai2010/[email protected]/webp.go:96:14: undefined: webpDecodeRGBAToSize
/root/go/pkg/mod/github.com/chai2010/[email protected]/webp.go:109:7: undefined: toGrayImage
/root/go/pkg/mod/github.com/chai2010/[email protected]/webp.go:110:14: undefined: webpEncodeGray
/root/go/pkg/mod/github.com/chai2010/[email protected]/webp.go:119:14: undefined: webpEncodeRGB
/root/go/pkg/mod/github.com/chai2010/[email protected]/webp.go:119:14: too many errors
golang版本:
go version go1.20.14 linux/amd64
The text was updated successfully, but these errors were encountered: