haraldk / TwelveMonkeys

TwelveMonkeys ImageIO: Additional plug-ins and extensions for Java's ImageIO
https://haraldk.github.io/TwelveMonkeys/
BSD 3-Clause "New" or "Revised" License
1.89k stars 314 forks source link

Support writing WebP format #659

Open kwin opened 2 years ago

kwin commented 2 years ago

Describe the solution you'd like As webp is a widely supported standard in browsers it should be possible to write in that format with this library to allow using it on server side for this use case.

haraldk commented 2 years ago

I'd like that too! 😀

maxim5 commented 2 years ago

@haraldk I'm sure you've seen https://github.com/sejda-pdf/webp-imageio

haraldk commented 2 years ago

@maxim5 Yes, I believe there are various ImageIO plugins that use the native libwebp for reading/writing through JNI. They probably perform better than our Java implementation, so if you can, use them! 😀

maxim5 commented 2 years ago

Yeah, don't have a lot of choices. That project seems to work, but hasn't updated libwebp for quite a while. So I mean if JNI is ok for you, you can use the same approach and clean it up a bit.

haraldk commented 2 years ago

I have no plans for going the JNI route with TwelveMonkeys.

But I think having several implementations, with different strengths is only a good thing. 👍🏻

gotson commented 2 years ago

Yeah, don't have a lot of choices. That project seems to work, but hasn't updated libwebp for quite a while. So I mean if JNI is ok for you, you can use the same approach and clean it up a bit.

I have worked on that project for a bit. The painful part is to compile the lib and JNI bit together, for multiple platforms. Because it's native code, you need a different compiled binary for each combination of OS and cpu architecture. And you need a specific loader to load the right one.

The issue with that lib is that it's not maintained, I tried to submit PRs to add support for more architectures, but it never went through. I ended up publishing it under my own org on maven central, and it's used in my open source application with some good success. I also use Twelvemonkeys for webp as a backup, since the app only needs to read webp, but never write it.

EricBlanquer commented 3 weeks ago

Hi, is it possible to add support to write WEBP? I don't want to use another dependency and I'm glad to have this support with ImageIO plugins

haraldk commented 3 weeks ago

@EricBlanquer It's absolutely possible. I don't have spare time to write it. That's why the issue is tagget with "sponsor needed". But anyone is free to write it and create a PR. I would happily accept it.😀