Google Answers Logo
View Question
 
Q: Java (looking for an open source JPEG decoder) ( No Answer,   13 Comments )
Question  
Subject: Java (looking for an open source JPEG decoder)
Category: Computers > Programming
Asked by: megacz-ga
List Price: $50.00
Posted: 18 Jun 2002 18:40 PDT
Expires: 25 Jun 2002 18:40 PDT
Question ID: 28781
Where can I find a 100%-pure-Java, open source (BSD, LGPL, X11, but
*not* GPL) progressive JPEG _decoder_ which does not rely on AWT, or
can easily be modified to not rely on it?

Ideally it would take an InputStream and return an int[] of samples --
this is the general level of functionality I'm looking for.

Incorrect answers you might be tempted to provide:
* JIMI (uses AWT behind your back for JPEG decoding -- argh!)
* Florian Raemy's decoder and the many derivitaves thereof (no
progressive support)
* IDG (C, not Java)
* JNI callout to C library (sorry, can't use JNI for security reasons)
* GNU Classpath (no AWT support, no JPEG decoder)

Also keep in mind that there are lots of *encoders* but few *decoders*
out there.

Clarification of Question by megacz-ga on 18 Jun 2002 19:32 PDT
JPEG and JPEG2000 are not the same thing. I'm looking for plain old JPEG.

Request for Question Clarification by studboy-ga on 19 Jun 2002 01:33 PDT
Have you checked out JAI?  They have a JPEG decoder:

http://developer.java.sun.com/developer/sampsource/jai/

Just want to make sure I'm on the right track...  thanks

Request for Question Clarification by 8ball-ga on 19 Jun 2002 02:56 PDT
I found this:

http://biron.usc.edu/~lengweha/jpeg/jpg.html

I don't know if this meets your needs or not.  It seems like a stretch
to me, so I am not posting it as an answer.  It looks experimental. 
However, it appears to be:

1.  pure java
2.  open source
3.  jpeg decoding independent of awt

On #3, I should make clear.  I definitely see awt being called, but I
think it is only being called to put widgets on the screen.

Clarification of Question by megacz-ga on 19 Jun 2002 09:38 PDT
From the JAI README:

  JPEG files are read and written using the classes found in the  
  com.sun.image.codec.jpeg  package of the Java 2 SDK.

com.sun.image.codec.jpeg uses JNI to call a C library. It's also not open source.

Clarification of Question by megacz-ga on 19 Jun 2002 09:43 PDT
> http://biron.usc.edu/~lengweha/jpeg/jpg.html 

Yeah, I've seen this before -- it doesn't support progressive JPEGs.

It also seems a bit broken -- I've tried using it and I can't get it
to display
an image. Does it work for you?

Regardless, I downloaded the source and verified that it doesn't even
attempt progressive support -- see HuffmanDecode.HuffmanDecode(URL,
TextArea) -- the switch block doesn't have a case arm for the
progressive JPEG marker.

This is, however, a good example of what I mean by something that "can
easily
be modified to not rely on AWT". So if this had offerend progressive
support,
it would have been a correct answer.

Clarification of Question by megacz-ga on 19 Jun 2002 09:56 PDT
You can't use Applet.getImage() either.

Request for Question Clarification by slumpy-ga on 20 Jun 2002 10:55 PDT
While I am no programmer, a very good friend is, and he suggested you
look at this:
http://lcavwww.epfl.ch/Demos/jpeg/

Hope it helps!!!

slumpy-ga

Clarification of Question by megacz-ga on 20 Jun 2002 15:20 PDT
> - the source is available in src.jar of every jdk since 1.2.

> This software is the proprietary information of Sun Microsystems,
Inc.
> Use is subject to license terms.

It's not <a href=http://www.opensource.org/docs/definition.php>open
source</a>.

> i don't see any JNI call in the code, maybe i'm missing it, could
> you please tell me where is it?

com.sun.image.codec.jpeg really doesn't do anything; it forwards all
its calls to sun.awt.image.codec.JPEGImageDecoderImpl, which makes JNI
calls:

private native void initDecoder(Class class1);
private synchronized native JPEGDecodeParam
readJPEGStream(InputStream...

Not trying to be difficult here; I just really need something that's
completely self-contained and open source.

  - a

Clarification of Question by megacz-ga on 20 Jun 2002 15:21 PDT
> http://lcavwww.epfl.ch/Demos/jpeg/ 

That's Florian Raemy's decoder; it doesn't support progressive JPEGs.
Answer  
There is no answer at this time.

Comments  
Subject: Re: Java (looking for an open source JPEG decoder)
From: sufian-ga on 18 Jun 2002 19:20 PDT
 
how about jasper

www.jasper.com

i think
Subject: Re: Java (looking for an open source JPEG decoder)
From: jdog-ga on 18 Jun 2002 19:26 PDT
 
I couldn't find anything about JPEG decompression on that site, are
you sure you got it right?
Subject: Re: Java (looking for an open source JPEG decoder)
From: jdog-ga on 18 Jun 2002 19:34 PDT
 
i think what you were talking about was

http://www.ece.ubc.ca/~mdadams/jasper/#faq

It doesn't fit megacz's description though (for one, it's written in C)
Subject: Re: Java (looking for an open source JPEG decoder)
From: mechmike-ga on 18 Jun 2002 23:59 PDT
 
Have you looked at the Sun Java Advanced Imaging API ?
http://java.sun.com/products/java-media/jai/index.html

They have a Decoder for JPEG.
Subject: Re: Java (looking for an open source JPEG decoder)
From: maruko-ga on 19 Jun 2002 06:54 PDT
 
http://java.sun.com/products/jdk/1.2/docs/guide/2d/api-jpeg/com/sun/image/codec/jpeg/package-summary.html
ciao
Subject: Re: Java (looking for an open source JPEG decoder)
From: megacz-ga on 19 Jun 2002 09:45 PDT
 
> http://java.sun.com/products/jdk/1.2/docs/guide/2d/api-jpeg/com/sun/image/codec/jpeg/package-summary.html

This code:
- Uses JNI to invoke a C library
- Is not open source
Subject: Re: Java (looking for an open source JPEG decoder)
From: 8ball-ga on 19 Jun 2002 11:24 PDT
 
Re: http://biron.usc.edu/~lengweha/jpeg/jpg.html  
 
>Yeah, I've seen this before -- it doesn't support progressive JPEGs.

Oops, my mistake.  Yet another good reason it is not the answer.  =)
 
>It also seems a bit broken -- I've tried using it and I can't get it
>to display an image. Does it work for you?

I have not actually used it, so I do not know.

Best of luck in your search.
Subject: Re: Java (looking for an open source JPEG decoder)
From: maruko-ga on 20 Jun 2002 00:52 PDT
 
>> http://java.sun.com/products/jdk/1.2/docs/guide/2d/api-jpeg/com/sun/image/codec/jpeg/package-summary.html
 
> This code: 
> - Uses JNI to invoke a C library 
> - Is not open source 

- the source is available in src.jar of every jdk since 1.2.
(/com/sun/image/codec/jpeg)
- i don't see any JNI call in the code, maybe i'm missing it, could
you please tell me where is it?

ciao
Subject: Re: Java (looking for an open source JPEG decoder)
From: megacz-ga on 20 Jun 2002 15:21 PDT
 
> - the source is available in src.jar of every jdk since 1.2. 
 
> This software is the proprietary information of Sun Microsystems,
Inc.
> Use is subject to license terms. 
 
It's not open source (http://www.opensource.org/docs/definition.php).
 
> i don't see any JNI call in the code, maybe i'm missing it, could 
> you please tell me where is it? 
 
com.sun.image.codec.jpeg really doesn't do anything; it forwards all
its calls to sun.awt.image.codec.JPEGImageDecoderImpl, which makes JNI
calls:
 
private native void initDecoder(Class class1); 
private synchronized native JPEGDecodeParam
readJPEGStream(InputStream...
 
Not trying to be difficult here; I just really need something that's
completely self-contained and open source.

  - a
Subject: Re: Java (looking for an open source JPEG decoder)
From: hedgie-ga on 22 Jun 2002 18:16 PDT
 
There is en decode/encoder in Java available form 
AudioVisual Communications Lab

http://lcavwww.epfl.ch/Demos/jpeg/
Subject: Re: Java (looking for an open source JPEG decoder)
From: skorba-ga on 30 Oct 2002 16:03 PST
 
Dear megacz-ga -

I am guessing here, but I assume you are running some kind of servlet
on a unix box (a headless environment), which is the only reason I can
see to avoid java.awt.* calls. Am I correct ?

Anyway: If your only objection to use jimi is the fact that Jimi will
call the abstract windowing toolkit, then that is easily remedied.

Use a set of (Open source) classes called pja, which is a 100 % pure
java awt implementation.

Go to
http://www.eteks.com/pja/en/ 
Download pja.jar and pjatools.jar

Together with Jimi they work like a charm - no native awt calls from
Java, and full awt access in you program.

Does that suit your need ?

If you want more info about how to configure java and/or tomcat to use
Jimi and PJA, please tell me.
Subject: Re: Java (looking for an open source JPEG decoder)
From: daldaver-ga on 21 Jul 2003 02:09 PDT
 
Hi,
If you have found the jpg decoder you're looking for please tell
because I'm looking for the same thing.

I need it to run it on a J2ME mobile debice. The limitations of J2ME
don't let using java.awt classes, and the Image class provided by J2ME
only supports images on PNG format. That's why I need a JPG pure java
decoder to get images from the web in JPG format, decode the images
and show them in PNG format in the mobile device. The only comment in
this forum which doesn't have any inconvenient is the PJA
(http://www.eteks.com/pja/en/). In PJA's documentation they said that
don't call any java.awt method, but java.awt classes are used in
creation of object, so I don't know if I will be able to use it.

Thanks.
David
Subject: Answer: SWT
From: megacz2-ga on 14 Jan 2005 01:17 PST
 
For history's sake, I figured I should post the answer I finally found
(which may not have been around
in 2002): the SWT user interface toolkit includes a class
(org.eclipse.internal.image.JPEGDecoder, I believe) which does exactly
this.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy