Hacker News new | ask | show | jobs
Golang has no WebP support (pkg.go.dev)
2 points by tim-montague 1342 days ago
3 comments

There 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

[1] https://github.com/chai2010/webp

Nitpick - 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/lrBF...

WebP 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

Golang and WebP were both developed at Google. https://en.wikipedia.org/wiki/WebP 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

I don't see why a language should have support of an image format. Isn't that library territory?