Open ainsleyclark opened 3 years ago
cc @nigeltao
A WebP encoder would be a lot of work. If someone wants to write one, that would be great. But as far as I know nobody is working on that.
That's a shame, whilst I understand that it may be a bit of work, it feels like it should be out of the box considering webp and go are both made by you guys!
Adding C bindings when converting to webp using third party packages can be messy, as well as using the executables.
I would love to offer a hand to contribute to the /x/image library but wouldn't know where to start.
I understand that it may be a bit of work
It's not a bit of work. As Ian said, it's a lot of work. :-)
That's a shame, whilst I understand that it may be a bit of work, it feels like it should be out of the box considering webp and go are both made by you guys!
Adding C bindings when converting to webp using third party packages can be messy, as well as using the executables.
The good news is that image encoding is much less of a security minefield than image decoding is, simply because the input format (a bitmap) is far, far simpler.
That said, have you considered ImageFlow? It’s free software (AGPL) available as both a daemon and a library. Commercial licenses are also available.
Hi there,
Thank you for the comments, I'm just wondering if this is being considered for a feature request?
Many thanks.
Yeah, this is so weird to have a reader but not writer in Go when Go and WebP are both Google's projects. Especially when there was all thus fuss about replacing "outdated" formats with modern Web* yet not providing native tools to do so. c'est la vie, i guess.
Please consider this request
Just thinking out loud here but instead of writing a native Go writer, why not just build it into Go itself? Again, both are Google projects. And while at it, having native support for vp8, vp9, av1... VIDEO would be a game-changer. It could be part of the Go build process where the additional code would get built into the executable only if used(called).
Starting a new website project with a Go backend and was planning on using WebP for image thumbnails and it's really sad to see that there's no native encoder.. :(
I would really like to avoid using C bindings (due to performance and memory safety concerns), but it seems that's the only option at the moment, except for executing the official webp
binary, which is also not the best idea, since you'd have to either write the file to disk or come up with a complicated virtual FS just for it.
I also considered using Rust, but that's way too advanced for me.
Edit: I found https://github.com/nickalie/go-webpbin which seems quite decent. haven't tested it yet though.
@ivanjaros AV1 support would be 🔥
@ivanjaros AV1 support would be 🔥
indeed. having native support for multimedia instead of having to call ffmpeg externally or some crazy cgo bridging would be sweet.
WebP is supported by all major browsers https://caniuse.com/?search=webp
This is currently blocking me from moving to WebP
I've tried to use other WebP encoder / decoders for Golang, which there are very few. None of them are pure Golang, or officially supported by the Standard Library in the way Gif, Jpeg, or Png have support.
Lmao, that Golang has no WebP support, when Google has the code and engineers for both in-house.
@ainsleyclark - I don't think AVIF is widely supported, so I can understand why that is not yet included in the Golang Standard Library.
@ex-tag considering the shift with Intel and Nvidia recently and major providers using AV1 and particularly AVIF for websites, future steps for supporting these fantastic encoders would be hugely beneficial for the stdlib. But can appreciate its not a small job.
Could go-libwebp by Jack Mordaunt offer a potential solution? I'm aware that rewriting libwebp in Go would be quite time-consuming, but Jack Mordaunt utilized ccgo and was able to port the libwebp C code to native Go code, making it functional, if I understand correctly. I'm not an expert, and I'm unsure of any potential risks this approach may present, but I wanted to share the idea. @JackMordaunt
I think there is a better solution. Example may use c-bindings from library on C language.
Could go-libwebp by Jack Mordaunt offer a potential solution? I'm aware that rewriting libwebp in Go would be quite time-consuming, but Jack Mordaunt utilized ccgo and was able to port the libwebp C code to native Go code, making it functional, if I understand correctly. I'm not an expert, and I'm unsure of any potential risks this approach may present, but I wanted to share the idea. @JackMordaunt
Thanks for the reference!
Yes, it's functional. However there's a lot of downside to the transpilation approach which bars it from being anything official.
ccgo
for transpilation, an experimental tool under active developmentuintptr
and thus totally unsafeFor anyone interested, go-libwebp
also allows calling into dynamic libraries if available. However this uses purego
to make those calls without requiring cgo. purego
is also an experimental tool.
Hi there,
Currently we are able to decode webp images, which is great. But why can't we encode them?
Given that PSI is such a crucial factor for getting websites to rank, it's important that any server should be able to convert and serve webp images.
I have to jump through hoops at the moment and use the webp executable which is far from ideal.
Please please add an encoder!
Many many thanks.