3 ms·
Golang has no WebP support
- tim-montague 4y agoWebP is considered to be a better image format than Gif, Jpeg, and Png. WebP is widely supported by every major browser. https://caniuse.com/?search=webp https://caniuse.com/?search=webp Golang and WebP were both developed at Google. https://en.wikipedia.org/wiki/WebP https://en.wikipedia.org/wiki/WebP https://en.wikipedia.org/wiki/Go_(programming_language) https://en.wikipedia.org/wiki/Go_(programming_language) Golang has image decoder / encoder support for Gif, Jpeg, and Png... but not WebP. https://pkg.go.dev/image@go1.19.2#section-directories https://pkg.go.dev/image@go1.19.2#section-directories
- ComputerGuru 4y agoI don't see why a language should have support of an image format. Isn't that library territory?
- jimsmart 4y agoThere is a decoder in golang.org/x/images/webp already [0], I don't know how full-featured it is: I've never used it. The x libs are part of the Go Project but outside the main Go tree — and are fairly well-known to many Go developers, but clearly not all. Stuff in x sometimes makes its way into the standard library, although not always. And there is a third-party package [1] for webp also, in native Go, which includes both a decoder and an encoder. Plus there are other third-party packages, that bind to external code (C libs, at a guess). — If your complaint is speficially that webp support should be a part of the standard library, then perhaps keep an eye on the stuff in x, that's often where stuff happens before making it into the stdlib. And/or file an issue. And/or you are welcome to contribute code ;) [0] https://pkg.go.dev/golang.org/x https://pkg.go.dev/golang.org/x [1] https://github.com/chai2010/webp https://github.com/chai2010/webp
- al2o3cr 4y agoNitpick - chai2010/webp avoids "binding to external code" by incorporating the entire libwebp distribution in "internal/libwebp-1.0.2" and compiling it. OTOH, folks have been saying "what if we rewrote the encoder in plain Go (no C)" since 2016 and it doesn't appear to have happened: https://groups.google.com/g/golang-nuts/c/gZ-PCUGw7Rk/m/lrBFg7QaAwAJ https://groups.google.com/g/golang-nuts/c/gZ-PCUGw7Rk/m/lrBF...