Skip to content
New issue

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

WebP output - killer feature #114

Closed
slav123 opened this issue Oct 1, 2017 · 23 comments
Closed

WebP output - killer feature #114

slav123 opened this issue Oct 1, 2017 · 23 comments
Labels
enhancement plugins Features that are good candidates for future plugin support.

Comments

@slav123
Copy link

slav123 commented Oct 1, 2017

I wrote similar service a while ago. Idea almost exactly as yours - for me killer feature was option to serve webp images as an output. It was based on browser detection (Chrome & Opera). Maybe there is a change at least ad ,webp output in yours ?

@willnorris
Copy link
Owner

See comments in #76 and #88. The only thing holding me back from adding webp encoding is just a library that supports it. As far as I know, no such Go library exists.

@slav123
Copy link
Author

slav123 commented Oct 2, 2017

It's just a matter of using vips to handle scaling. Sory for my spaghetti code it was long learning curve for me:

https://github.com/slav123/go-resizer

but basically this library solves your problem:

https://github.com/h2non/bimg/tree/v1.0.14

@willnorris
Copy link
Owner

The problem with bimg (and vips) is that it's a cgo library, not pure go. I'm not willing to take on C dependencies, since it adds complexity that I don't really want to deal with and doesn't really solve any problems that I have. Others are of course free to use cgo libraries in their own forks, but I don't have plans to accept them in this copy of imageproxy.

@ramiel
Copy link

ramiel commented Jan 29, 2018

What about https://github.com/nickalie/go-webpbin?

@willnorris
Copy link
Owner

What about nickalie/go-webpbin?

that's simply a wrapper around a command line tool, not an actual go library.

@ramiel
Copy link

ramiel commented Jan 30, 2018

And https://github.com/chai2010/webp instead?
Sorry, I'm not a GO developer

@willnorris
Copy link
Owner

chai2010/webp is using cgo, which makes things more complicated and less portable (read more at https://dave.cheney.net/2016/01/18/cgo-is-not-go).

As people have added more caching storage backends, and the imageproxy binary size has grown pretty substantially, I've been thinking about how to rearchitect it to have some sort of plugin system. If and when that were to happen, I'd be fine with added an optional plugin that used cgo or called out to separate process. But as things are now, my plan is to limit it to pure go.

@ramiel
Copy link

ramiel commented Jan 31, 2018

Well, good to discover new things.

@willnorris willnorris added enhancement plugins Features that are good candidates for future plugin support. labels Mar 23, 2019
@tuananh
Copy link

tuananh commented Apr 6, 2020

@willnorris has anything change regarding webp support in go?

@willnorris
Copy link
Owner

Not that I'm aware of

@muety
Copy link

muety commented Sep 11, 2020

@slav123 Does the code of your service still exist somewhere? I'm basically looking for exactly what you seem to have build – an image proxy that conditionally converts PNG or JPG to webp if the requesting browser supports it.

EDIT: Never mind, just found in in your comment above.

@ramiel
Copy link

ramiel commented Sep 11, 2020

https://caravaggio.ramielcreations.com/

@slav123
Copy link
Author

slav123 commented Sep 11, 2020 via email

@willnorris
Copy link
Owner

willnorris commented Sep 11, 2020

There's also https://github.com/imgproxy/imgproxy if you want to stick with something written in (mostly) go. They use cgo, which allows them to add webp support, use vips for faster transformations and encoding, etc.

@willnorris willnorris mentioned this issue Sep 23, 2021
@zquestz
Copy link

zquestz commented Aug 13, 2022

I forked this project to add webp encoding. Hopefully it is useful to some folks. I have it in production and it is quite stable.

https://github.com/zquestz/imageproxy

@tuananh
Copy link

tuananh commented Aug 14, 2022

I forked this project to add webp encoding. Hopefully it is useful to some folks. I have it in production and it is quite stable.

https://github.com/zquestz/imageproxy

This is very nice. Why not put a pr here?

@willnorris
Copy link
Owner

This is very nice. Why not put a pr here?

Because I wouldn't merge it :) As discussed in this and related issues, I've decided to keep imageproxy as only using pure go libraries, not any that require cgo. https://github.com/kolesa-team/go-webp, which @zquestz's fork uses, requires cgo.

@tuananh
Copy link

tuananh commented Aug 14, 2022

I see. Maybe document this fork in the readme for better visibility?

@willnorris
Copy link
Owner

filed #353 to track that

@sunstarjeff
Copy link

I forked this project to add webp encoding. Hopefully it is useful to some folks. I have it in production and it is quite stable.

https://github.com/zquestz/imageproxy

Pardon my ignorance, but how would someone who already uses ImageProxy install and utilize your fork in order to realize .webp in/out?

@zquestz
Copy link

zquestz commented Aug 22, 2022

I forked this project to add webp encoding. Hopefully it is useful to some folks. I have it in production and it is quite stable.
https://github.com/zquestz/imageproxy

Pardon my ignorance, but how would someone who already uses ImageProxy install and utilize your fork in order to realize .webp in/out?

Easiest way is with docker. docker run -p 8080:8080 zquestz/imageproxy -addr 0.0.0.0:8080

Then in your resizer call, add webp as the output. For instance http://localhost:8080/750x,webp/https://somehost.com/image.png

@sunstarjeff
Copy link

Thank you, we're running an existing command line process in a production environment which runs a batch file with "imageproxy -allowHosts *host.com". Since your fork has the same name, I'm just not very clear on how it would work to attempt to run an alternate library. Likely, it's my own ignorance on the subject. I wish the primary ImageProxy library had webp support, with Google PageSpeed now giving sites a negative score for sites that don't offer "next gen formats".

@zquestz
Copy link

zquestz commented Aug 23, 2022

Ahh to build it. Just do the following:

  1. Clone github.com/zquestz/imageproxy
  2. cd imageproxy/cmd/imageproxy
  3. go install .

This should build a working binary with the updated feature set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement plugins Features that are good candidates for future plugin support.
Projects
None yet
Development

No branches or pull requests

7 participants