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
Add basic WebP format support. #4
Conversation
- decode/encode - partial build (platform/unix)
1645cc9
to
368a9b2
Compare
int width, height; | ||
uint8_t *pdata = WebPDecodeRGBA((uint8_t*)data->getData(), data->getSize(), &width, &height); | ||
|
||
if(pdata){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per our code style guide, braces go on a new line and there should be a space between the if
and the (
.
Is there a corresponding change to megasource (cmake dependencies) and the love-android repository along with this? Is libwebp trivial to build for macOS and iOS as well? What sort of use case do you have in mind for webp files that isn't covered by png and jpeg? Adding and then maintaining a dependency like this isn't free for us, so its cost needs to be offset by solid use cases. |
No I didn't take care of the whole cross-platform build process, this is only the implementation and a few changes to test on POSIX systems. I don't know how exactly LÖVE is maintained. https://developers.google.com/speed/webp/download I understand about the dependency issue, but WebP has potential. I showed some examples on the topic, the basic implementation would give:
Then you could use the animation feature for interesting stuff, but that would require new APIs. I don't know if it's worth the effort from your point of view. To me moving forward is important, so if I can get rid of PNG, JPEG and GIF at once in my work with improvements, I will. This pull request is mostly about showing how simple the libwebp API is. |
I'm not sure about iOS and macOS, but I think libwebp integrates with Megasource since it has CMake scripts. It also looks like integrates well with love-android as it provides their own Android.mk file. |
With hindsight, altough interesting, supporting WebP is not essential. There is work on new image formats; particularly JPEG XL looks promising. It seems that the rate of progress is faster than the rate of adoption, we probably need to hit a wall to reach consensus. |
What I'm really hoping for with WebP is for someone to make a minimal single-file or very small decoding library for it, similar to stb_image or LodePNG, since the reference/official library is so big. I never looked at the spec or anything though, so I suppose it's possible the format is complicated enough that something as small as LodePNG isn't ever going to happen for WebP. |
As discussed here.
It's a basic encoding (lossless) / decoding implementation. Tested under GNU/Linux.
You're free to use it or not, but at least the work is done if the feature is desired at some point.