WebP encoder for Java?

2,016 views
Skip to first unread message

David Ekholm

unread,
Jan 11, 2012, 2:10:38 PM 1/11/12
to WebP Discussion
Hi guys. Wonderful to see a WebP decoder for Java, but how about a
Java WebP encoder too? I'm the author of jAlbum - a very popular
freeware tool for making web photo albums. There are literally
millions of JPEG images produced by jAlbum on a monthly basis (and
spread to web sites all over the world). I think adding a WebP
encoder
to jAlbum would help giving this new format a real boost. Please
contact us!

Pascal Massimino

unread,
Jan 11, 2012, 3:26:47 PM 1/11/12
to webp-d...@webmproject.org, Dominik Homberger
Hi David,

Dominik (CC'd) has an encoder based on v0.1.3 here: http://libwebpjs.appspot.com/v0.1.3/
You guys should talk :)



--
You received this message because you are subscribed to the Google Groups "WebP Discussion" group.
To post to this group, send email to webp-d...@webmproject.org .
To unsubscribe from this group, send email to webp-discuss...@webmproject.org .
For more options, visit this group at http://groups.google.com/a/webmproject.org/group/webp-discuss/?hl=en .


Dominik Homberger

unread,
Jan 11, 2012, 4:02:02 PM 1/11/12
to WebP Discussion

Pepijn Van Eeckhoudt

unread,
Jan 12, 2012, 12:57:18 AM 1/12/12
to webp-d...@webmproject.org
I mentioned this briefly earlier already but I have some Java code that builds on the swig binding your referring to. Basically wraps it into an ImageIO plugin. In my opinion this makes more sense for an image codec Java binding.

It's pretty basic right now, but I would be happy to contribute it as is. Should I make a bug report for this and attach the code?

Pepijn

Verstuurd vanaf mijn iPhone

David Ekholm

unread,
Jan 12, 2012, 3:30:11 AM 1/12/12
to webp-d...@webmproject.org, Dominik Homberger
Great to know there is at least a Java binding out there, but aren't there efforts to making a 100% Java ImageIO implementation of a WebP encoder/decoder?
jAlbum is multiplatform so maintaining native libraries for Win32/Win64/Mac32/Mac64 and various Linux flavors could be tedious.

Regards
/David

David Ekholm

unread,
Jan 12, 2012, 3:32:03 AM 1/12/12
to webp-d...@webmproject.org
Great to know there is at least a Java binding out there, but aren't there efforts to making a 100% Java ImageIO implementation of a WebP encoder/decoder?
jAlbum is multiplatform so maintaining native libraries for Win32/Win64/Mac32/Mac64 and various Linux flavors could be tedious.

Regards/David

David Ekholm

unread,
Jan 12, 2012, 3:36:04 AM 1/12/12
to webp-d...@webmproject.org
Yes, please contribute your ImageIO plugin! jAlbum is already using the ImageIO API so I prefer to use an ImageIO wrapper. Ideally I'd like to see a 100% Java implementation of an ImageIO based WebP encoder/decoder for Java. Does anyone know if that is in the workings?

Regards/David

Pepijn Van Eeckhoudt

unread,
Jan 12, 2012, 6:13:36 AM 1/12/12
to webp-d...@webmproject.org
On 12/01/2012 09:36, David Ekholm wrote:
Ideally I'd like to see a 100% Java implementation of an ImageIO based WebP encoder/decoder for Java. Does anyone know if that is in the workings?
It's defintely not something I'm going to spend any time on. In my opinion there are a lot of reasons not to do this amongst which:
  • Large effort to reimplement a library that already exists
  • Most likely significantly slower due to lack of SIMD optimizations
  • libwebp is still under very active development so you're chasing a moving target

I have been considering making the Java bindings more sophisticated than the current ones though. Currently only the high-level convenience API is exposed which does not provide access to the more advanced encoder settings.

Pepijn

David Ekholm

unread,
Jan 12, 2012, 6:19:34 AM 1/12/12
to webp-d...@webmproject.org
Is there anyone at Google I can contact?

In the meantime I appreciate trying out your ImageIO solution.

Regards
/David

Pascal Massimino

unread,
Jan 12, 2012, 7:12:52 AM 1/12/12
to webp-d...@webmproject.org
Hi,

On Thu, Jan 12, 2012 at 3:13 AM, Pepijn Van Eeckhoudt < pep...@vaneeckhoudt.net > wrote:
On 12/01/2012 09:36, David Ekholm wrote:
Ideally I'd like to see a 100% Java implementation of an ImageIO based WebP encoder/decoder for Java. Does anyone know if that is in the workings?
It's defintely not something I'm going to spend any time on. In my opinion there are a lot of reasons not to do this amongst which:
  • Large effort to reimplement a library that already exists
  • Most likely significantly slower due to lack of SIMD optimizations

+1
Re-writing in Java is a lot of effort for something that will be slower, use more memory, etc.
What is the reason behind not using the JNI? Security?

  • libwebp is still under very active development so you're chasing a moving targe 

    I have been considering making the Java bindings more sophisticated than the current ones though.


    That'd be awesome. Please contribute back patches if you have some!

    Currently only the high-level convenience API is exposed which does not provide access to the more advanced encoder settings.

    Pepijn
    --

    Pascal Massimino

    unread,
    Jan 12, 2012, 7:13:50 AM 1/12/12
    to webp-d...@webmproject.org, Dominik Homberger
    On Wed, Jan 11, 2012 at 12:26 PM, Pascal Massimino < pascal.m...@gmail.com > wrote:
    Hi David,

    On Wed, Jan 11, 2012 at 11:10 AM, David Ekholm < da...@jalbum.net > wrote:
    Hi guys. Wonderful to see a WebP decoder for Java, but how about a
    Java WebP encoder too? I'm the author of jAlbum - a very popular
    freeware tool for making web photo albums. There are literally
    millions of JPEG images produced by jAlbum on a monthly basis (and
    spread to web sites all over the world). I think adding a WebP
    encoder
    to jAlbum would help giving this new format a real boost. Please
    contact us!

    Dominik (CC'd) has an encoder based on v0.1.3 here: http://libwebpjs.appspot.com/v0.1.3/
    You guys should talk :)


    Oops, sorry, scrape that. I read too fast: confused "Java" with "Javascript" :)

    Pepijn Van Eeckhoudt

    unread,
    Jan 12, 2012, 7:36:49 AM 1/12/12
    to webp-d...@webmproject.org
    On 12/01/2012 13:12, Pascal Massimino wrote:

      I have been considering making the Java bindings more sophisticated than the current ones though.

      That'd be awesome. Please contribute back patches if you have some!
      Would you prefer sticking with swig for this or is hand written JNI code fine as well? Just asking because I have absolutely no experience with swig whatsoever.

      Also, when integrating the imageio java code, how should I go about compiling it? Autotools is another black magic area for me at this time.

      Pepijn

      David Ekholm

      unread,
      Jan 12, 2012, 7:41:25 AM 1/12/12
      to webp-d...@webmproject.org
      Hi. The reason for avoiding JNI is maintainability: We provide jAlbum for several operating systems. I can imagine it to be a drag to compile for Win32+Win64+Mac32+Mac64+linux flavors :-(

      Regards
      /David

      Brooss

      unread,
      Jan 12, 2012, 9:50:25 PM 1/12/12
      to WebP Discussion
      Hi David,

      On Jan 12, 6:10 am, David Ekholm < da...@jalbum.net > wrote:
      > Hi guys. Wonderful to see a WebP decoder for Java, but how about a
      > Java WebP encoder too?

      I'm the author of the JavaVP8Decoder project ( http://sourceforge.net/
      projects/javavp8decoder/) that provides a native ImageIO plugin for
      WebP decoding. Is that what you are referring to here?

      > Ideally I'd like to see a 100% Java implementation of an ImageIO based WebP encoder/decoder for Java. Does anyone know if that is in the workings?

      As far as I know, my project is the only native Java implementation,
      and it's currently decoder only (although it should be fully working
      for WebP).

      David Ekholm

      unread,
      Jan 13, 2012, 3:10:16 AM 1/13/12
      to webp-d...@webmproject.org
      > Hi David,
      >
      > On Jan 12, 6:10 am, David Ekholm < da...@jalbum.net > wrote:
      >> Hi guys. Wonderful to see a WebP decoder for Java, but how about a
      >> Java WebP encoder too?
      >
      > I'm the author of the JavaVP8Decoder project ( http://sourceforge.net/
      > projects/javavp8decoder/) that provides a native ImageIO plugin for
      > WebP decoding. Is that what you are referring to here?

      No, actually I mainly refer to an encoder for WebP, but having that, it's good to have a decoder too naturally.

      >
      >> Ideally I'd like to see a 100% Java implementation of an ImageIO based WebP encoder/decoder for Java. Does anyone know if that is in the workings?
      >
      > As far as I know, my project is the only native Java implementation,
      > and it's currently decoder only (although it should be fully working
      > for WebP).

      I guess making jAlbum support the reading of WebP images is only about putting the jar file for your decoder in jAlbum's library path. Thank you for making it!

      Xiteng Liu

      unread,
      Jan 16, 2012, 7:42:04 PM 1/16/12
      to WebP Discussion
      Hi David,

      Can you please advise me why you need WebP to replace JPEG for your
      JAlbum? Have you ever tried JPEG2000 or JPEG XR? I have my own
      technology posted at http://qualvisual.net . If you like it, please let
      me know. Thanks,

      -Xiteng

      Ram Ramani

      unread,
      Jan 16, 2012, 11:45:04 PM 1/16/12
      to webp-d...@webmproject.org
      Hi Xiteng,
      While technical critic on WebP is welcome, please do not use this forum to advertise your product! Please post responsibly and allow meaningful technical discussions, to maintain sanity in this forum.

      Ram

      Xiteng Liu

      unread,
      Jan 17, 2012, 4:32:15 AM 1/17/12
      to webp-d...@webmproject.org
      Hi Ram,

      Thank you for reminding. But I did not intend to "advertise" on
      anything. On the WebP webpage, there is only comparison with JPEG. To
      me and other experts, that is not enough and makes no sense at all,
      since JPEG has already been outdated from research for along time.
      And, that comparison may mislead amatures too. As a responsible, giant
      company like Google, it should be open to any comment or chanllenge. I
      do have some suspicion and confusion about the WebP performance
      claims. Therefore, I am trying to find performance compartison between
      WebP and JPEG2000, JPEG XR, in order to strengthen my comments and
      claims on my own technology. Thank you for your reply anyway.

      Sincerely,

      -Xiteng

      David Ekholm

      unread,
      Jan 17, 2012, 4:39:00 AM 1/17/12
      to webp-d...@webmproject.org
      Hi. I just want jAlbum to alternatively support a new emerging image format, and I believe such a format will need to be backed by a big company / organisation in order to have the power to become big.

      I have so far not tried JPEG2000 or JPEG XR. As I understand it, so far no other alternative to JPEG has really gained traction.

      Regards/David

      James Zern

      unread,
      Jan 17, 2012, 3:19:13 PM 1/17/12
      to WebP Discussion


      On Jan 12, 4:36 am, Pepijn Van Eeckhoudt < pep...@vaneeckhoudt.net >
      wrote:
      > On 12/01/2012 13:12, Pascal Massimino wrote:
      >
      > >     I have been considering making the Java bindings more
      > >     sophisticated than the current ones though.
      >
      > > That'd be awesome. Please contribute back patches if you have some!
      >
      > Would you prefer sticking with swig for this or is hand written JNI code
      > fine as well? Just asking because I have absolutely no experience with
      > swig whatsoever.
      >
      I prefer to extract things from the library itself with swig. Further
      wrappers on top of those calls can be done as you like. If there is
      significant JNI code then afterward we can at least look at embedding
      it into some of the general swig configuration.
      Note that for your code to be included in our repository you'll need
      to sign a contributor agreement [1]. After you set that up you can
      post things to gerrit for review.

      > Also, when integrating the imageio java code, how should I go about
      > compiling it? Autotools is another black magic area for me at this time.
      >
      At the moment the swig itself is stand alone, so don't worry about
      auto-detecting the build environment. For the first pass a README with
      notes on the requirements and build steps should be enough.

      [1]: http://www.webmproject.org/code/contribute/submitting-patches/

      Pepijn Van Eeckhoudt

      unread,
      Jan 17, 2012, 4:02:15 PM 1/17/12
      to webp-d...@webmproject.org
      On 1/17/2012 9:19 PM, James Zern wrote:
      > I prefer to extract things from the library itself with swig. Further
      > wrappers on top of those calls can be done as you like. If there is
      > significant JNI code then afterward we can at least look at embedding
      > it into some of the general swig configuration.
      I've been working on this in the meantime, but it feels like I'm
      fighting with swig to get it to generate the right code. I was now
      considering splitting the decoder and encoder header files into a types
      and functions header file. Then let swig generate wrappers for the
      structs and do the function wrapping by hand. Would that make sense?

      Pepijn

      James Zern

      unread,
      Jan 17, 2012, 8:16:23 PM 1/17/12
      to WebP Discussion


      On Jan 17, 1:02 pm, Pepijn Van Eeckhoudt < pep...@vaneeckhoudt.net >
      wrote:
      To avoid this problem the current libwebp.i specifically names the
      functions to import rather than attempt to import the entire header
      file. The same could be done for the structs, etc. It is unfortunate
      as it causes code duplication, but was easier that littering the code
      with #ifndef SWIG.
      Reply all
      Reply to author
      Forward
      0 new messages