-
Notifications
You must be signed in to change notification settings - Fork 276
Support writing lossless WebP #327
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
Conversation
Lossless WebP is a rather interesting alternative to PNG, and already supported by `gdImageCreateFromWebp*()`, so we add support for `gdImageWebp*()`, too. We can stick with the existing API, using the quality parameter to request lossless encoding if it is set to `gdWebpLossless`, which we define to `PHP_INT` (to avoid adding a new dependency to gd.h, we hard- code the value – we're assuming `sizeof(int)==4` anyway).
|
Apparently, |
|
Can you fix the conflict and see if we can get that merged? |
|
Hi @cmb69 ! Is the issue you mentioned above still a blocker? I see that the lossless functions are listed in the WebP API docs, at least... /cc @adamsilverstein |
|
Well, I guess it's not a hard blocker anyway; we could detect whether it is supported during configuration, and use it if requested and available, and otherwise let the function call fail. If you want to take this PR, please do so. :) |
|
Thanks, @cmb69. I could look at this, perhaps after I finish propagating #671 into PHP - or perhaps as a pleasant break from that task, once I get into it :) I'd be curious to find out whether |
I'm not sure why I've picked that value; it's only important to use a value which isn't useful for lossy quality (I think [0,100]). OTOH, the actual value doesn't really matter as long as we're defining a macro. |
|
Noting that in the WordPress imagick engine case, passing a value of 100 indicates we want to use the lossless format. Would that approach work here @cmb69? |
|
Well, |
|
I've been struggling with the same thing. I don't suppose
|
|
Maybe treat any value > 100 as lossless; the value of |
|
value > 100 makes sense, thanks for the feedback, I will adjust the code and open a new PR. |
Lossless WebP is a rather interesting alternative to PNG, and already
supported by
gdImageCreateFromWebp*(), so we add support forgdImageWebp*(), too.We can stick with the existing API, using the quality parameter to
request lossless encoding if it is set to
gdWebpLossless, which wedefine to
PHP_INT(to avoid adding a new dependency to gd.h, we hard-code the value – we're assuming
sizeof(int)==4anyway).