Skip to main content

[JAI-IMAGEIO] JPEG Image reported as unsupported by ImageIO

25 replies [Last post]
aryland
Offline
Joined: 2006-04-22

I have come across a JPEG image that ImageIO will not load, this is surely due to some irregularity in the image, but since this image will load in most other applications, it still can be viewed as a bug in my code, which is using ImageIO.

I have filtered the image to try and get it to load and I have discovered that the problematic header segment is the App14 segment, There is also a large ICC profile in the image, but that can be filtered out.

In the image I am using in this test case, I have filtered out all the headers except the App14 header. If this header is filtered away, then the image will load, but the colors will be completely wrong as a result.

ImageIO reports this image as unsupported, there must be something strange in the metadata but I cannot debug this since it is done by native code and calledback with the
private void setImageData(int width,
int height,
int colorSpaceCode,
int outColorSpaceCode,
int numComponents,
byte [] iccData);
method...

The problem is that the public Iterator getImageTypes(int imageIndex); method returns an empty iterator because the colorSpaceCode doesnt match anything in the switch case.

I am wondering if there is something that can be done so that this image can be loaded despite the irregularities in the image.

The image:
http://quickdump.com/files/1002788029.html

Case that tries to load this image

mport java.awt.image.BufferedImage;
import java.io.FileInputStream;
import java.util.Iterator;

import javax.imageio.ImageIO;
import javax.imageio.ImageReader;
import javax.imageio.stream.ImageInputStream;

public class JPEGTestCase {
public static void main(String [] args){
try {
FileInputStream imageStream = new
FileInputStream("c:/temp/jpegErrorImage2.jpg");
// replace this with the path of the image
ImageInputStream iis = null;
ImageReader reader = null;

iis = ImageIO.createImageInputStream(imageStream);

Iterator readers = ImageIO.getImageReaders(iis);
reader = (ImageReader)readers.next();
reader.setInput(iis,false);

BufferedImage image = reader.read(0);
} catch(Exception e){
e.printStackTrace();
}

}
}

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Brian Burkhalter

You are still picking up the Java SE JPEG reader, not the JAI-Image I/O one.

Brian

On Tue, 25 Apr 2006, jai-imageio@javadesktop.org wrote:

> Thanks! I had mixed clib and mlib. I was able to run the program and got:
>
> --- com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReader ---
> javax.imageio.IIOException: Unsupported Image Type
> at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:889)
> at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:864)
> at javax.imageio.ImageReader.read(ImageReader.java:923)
> at com.mobiletech.imageconverter.tests.JPEGTestCase.main(JPEGTestCase.java:30)
> --- com.sun.imageio.plugins.jpeg.JPEGImageReader ---
> --- codecLib is available ---
>
> So I have the libs, but can still not read the image. and this test case works for you ?
> [Message sent by forum member 'aryland' (aryland)]
>
> http://forums.java.net/jive/thread.jspa?messageID=107831
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-imageio.dev.java.net
>
>

----------------
Brian Burkhalter
Java Media, Imaging, and Graphics
Sun Microsystems, Inc.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

aryland
Offline
Joined: 2006-04-22

I think u may misread the code, as I did the frist time. I dont know if I get the right one or not, but it is indeed working. The code that James provided is trying to read the image with 2 different jpeg readers, one of the causes the exception shown in the output, and the other successfully reads the image.

The image works in my application now so I am happy ;)

> You are still picking up the Java SE JPEG reader, not
> the JAI-Image I/O one.
>
> Brian
>
> On Tue, 25 Apr 2006, jai-imageio@javadesktop.org
> wrote:
>
> > Thanks! I had mixed clib and mlib. I was able to
> run the program and got:
> >
> > ---
> com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageRe
> ader ---
> > javax.imageio.IIOException: Unsupported Image Type
> > at
> com.sun.imageio.plugins.jpeg.JPEGImageReader.readInter
> nal(JPEGImageReader.java:889)
> > at
> com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEG
> ImageReader.java:864)
> > at
> javax.imageio.ImageReader.read(ImageReader.java:923)
> > at
> com.mobiletech.imageconverter.tests.JPEGTestCase.main(
> JPEGTestCase.java:30)
> > --- com.sun.imageio.plugins.jpeg.JPEGImageReader
> ---
> > --- codecLib is available ---
> >
> > So I have the libs, but can still not read the
> image. and this test case works for you ?
> > [Message sent by forum member 'aryland' (aryland)]
> >
> >
> http://forums.java.net/jive/thread.jspa?messageID=1078
> 31
> >
> >
> ------------------------------------------------------
> ---------------
> > To unsubscribe, e-mail:
> interest-unsubscribe@jai-imageio.dev.java.net
> > For additional commands, e-mail:
> interest-help@jai-imageio.dev.java.net
> >
> >
>
> ----------------
> Brian Burkhalter
> Java Media, Imaging, and Graphics
> Sun Microsystems, Inc.
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~~~~~~~~~~
> This email message is for the sole use of the
> intended recipient(s)
> and may contain confidential and privileged
> information. Any
> unauthorized review, use, disclosure or distribution
> is prohibited.
> If you are not the intended recipient, please contact
> the sender by
> reply email and destroy all copies of the original
> message.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~~~~~~~~~~
>
> ------------------------------------------------------
> ---------------
> To unsubscribe, e-mail:
> interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail:
> interest-help@jai-imageio.dev.java.net

I think u may misread the code, as I did the frist time. I dont know if I get the right one or not, but it is indeed working. The code that James provided is trying to read the image with 2 different jpeg readers, one of the causes the exception shown in the output, and the other successfully reads the image.

James Cheng

> I think u may misread the code, as I did the frist time. I dont know
> if I get the right one or not, but it is indeed working. The code
> that James provided is trying to read the image with 2 different jpeg
> readers, one of the causes the exception shown in the output, and the
> other successfully reads the image.

Just to be clear, the code of trying all available JPEG readers is not
really necessary. By default, the CLibJPEGImageReader has a higher
priority than the JPEGImageReader in the registry. Your original test
case should work with the latest stable build of JAI Image I/O Tools
if it is installed properly.

Thanks,
-James

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

aryland
Offline
Joined: 2006-04-22

Yes, my application code does not loop though the image readers like in the test case.

> > I think u may misread the code, as I did the frist
> time. I dont know
> > if I get the right one or not, but it is indeed
> working. The code
> > that James provided is trying to read the image
> with 2 different jpeg
> > readers, one of the causes the exception shown in
> the output, and the
> > other successfully reads the image.
>
> Just to be clear, the code of trying all available
> JPEG readers is not
> really necessary. By default, the
> CLibJPEGImageReader has a higher
> priority than the JPEGImageReader in the registry.
> Your original test
> case should work with the latest stable build of JAI
> Image I/O Tools
> if it is installed properly.
>
> Thanks,
> -James
>
> ------------------------------------------------------
> ---------------
> To unsubscribe, e-mail:
> interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail:
> interest-help@jai-imageio.dev.java.net

dpeckham
Offline
Joined: 2007-12-03

I'm also having this same problem, but the sample code in this thread is not working for me. The loop always shows only one reader is available:

import javax.imageio.ImageIO;
import javax.imageio.ImageReader;
import javax.imageio.stream.ImageInputStream;
import java.io.InputStream;
import java.util.Iterator;

public class JPEGTestCase {
public static void main(String[] args) throws Exception {

InputStream imageStream = JPEGTestCase.class.getClassLoader().getResourceAsStream("bug_2672_250226.jpg");
ImageInputStream iis = null;
ImageReader reader = null;

iis = ImageIO.createImageInputStream(imageStream);

Iterator readers = ImageIO.getImageReaders(iis);
while (readers.hasNext()) {
reader = (ImageReader) readers.next();
System.out.println("--- " + reader.getClass().getName() + " ---");
}
}
}

$java -cp . JPEGTestCase
--- com.sun.imageio.plugins.jpeg.JPEGImageReader ---

Even tried adding everything to the classpath, though the install docs say not to.
$ java -cp .:/cp/java/jre/lib/ext/clibwrapper_jiio.jar:/cp/java/jre/lib/ext/mlibwrapper_jai.jar:/cp/java/jre/lib/ext/jai_core.jar:/cp/java/jre/lib/ext/jai_codec.jar:/cp/java/jre/lib/ext/jai_imageio.jar JPEGTestCase
--- com.sun.imageio.plugins.jpeg.JPEGImageReader ---

Also tried with LD_LIBRARY_PATH=/cp/java/jre/lib/i386

System information:

$ cat /proc/version
Linux version 2.6.18-8.1.14.el5 (mockbuild@builder6.centos.org) (gcc version 4.1.1 20070105 (Red Hat 4.1.1-52)) #1 SMP Thu Sep 27 19:05:32 EDT 2007

$ java -version
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_03-b05, mixed mode)

I installed:

jai-1_1_3-lib-linux-i586-jdk.bin
jai_imageio-1_1-lib-linux-i586-jdk.bin

without error.

$ls jre/lib/etc
clibwrapper_jiio.jar
dnsns.jar
jai_codec.jar
jai_core.jar
jai_imageio.jar
localedata.jar
meta-index
mlibwrapper_jai.jar
sunjce_provider.jar
sunpkcs11.jar

I must be missing something simple.

Thanks,
Dave

Nidel, Mike

are you sure that your native clib libraries are being picked up?
you could try printing the result of
System.getProperty("java.library.path") for example.

I assume that the jai imageio tools .so files are in
/cp/java/jre/lib/i386 ?
libclib_jiio.so or the like...?

> -----Original Message-----
> From: jai-imageio@javadesktop.org
> [mailto:jai-imageio@javadesktop.org]
> Sent: Monday, December 03, 2007 4:42 PM
> To: interest@jai-imageio.dev.java.net
> Subject: Re: [JAI-IMAGEIO] JPEG Image reported as unsupported
> by ImageIO
>
> I'm also having this same problem, but the sample code in
> this thread is not working for me. The loop always shows only
> one reader is available:
>
> import javax.imageio.ImageIO;
> import javax.imageio.ImageReader;
> import javax.imageio.stream.ImageInputStream;
> import java.io.InputStream;
> import java.util.Iterator;
>
> public class JPEGTestCase {
> public static void main(String[] args) throws Exception {
>
> InputStream imageStream =
> JPEGTestCase.class.getClassLoader().getResourceAsStream("bug_2
> 672_250226.jpg");
> ImageInputStream iis = null;
> ImageReader reader = null;
>
> iis = ImageIO.createImageInputStream(imageStream);
>
> Iterator readers = ImageIO.getImageReaders(iis);
> while (readers.hasNext()) {
> reader = (ImageReader) readers.next();
> System.out.println("--- " +
> reader.getClass().getName() + " ---");
> }
> }
> }
>
> $java -cp . JPEGTestCase
> --- com.sun.imageio.plugins.jpeg.JPEGImageReader ---
>
> Even tried adding everything to the classpath, though the
> install docs say not to.
> $ java -cp
> .:/cp/java/jre/lib/ext/clibwrapper_jiio.jar:/cp/java/jre/lib/e
> xt/mlibwrapper_jai.jar:/cp/java/jre/lib/ext/jai_core.jar:/cp/j
> ava/jre/lib/ext/jai_codec.jar:/cp/java/jre/lib/ext/jai_imageio
> .jar JPEGTestCase
> --- com.sun.imageio.plugins.jpeg.JPEGImageReader ---
>
> Also tried with LD_LIBRARY_PATH=/cp/java/jre/lib/i386
>
> System information:
>
> $ cat /proc/version
> Linux version 2.6.18-8.1.14.el5
> (mockbuild@builder6.centos.org) (gcc version 4.1.1 20070105
> (Red Hat 4.1.1-52)) #1 SMP Thu Sep 27 19:05:32 EDT 2007
>
> $ java -version
> java version "1.6.0_03"
> Java(TM) SE Runtime Environment (build 1.6.0_03-b05) Java
> HotSpot(TM) 64-Bit Server VM (build 1.6.0_03-b05, mixed mode)
>
> I installed:
>
> jai-1_1_3-lib-linux-i586-jdk.bin
> jai_imageio-1_1-lib-linux-i586-jdk.bin
>
> without error.
>
> $ls jre/lib/etc
> clibwrapper_jiio.jar
> dnsns.jar
> jai_codec.jar
> jai_core.jar
> jai_imageio.jar
> localedata.jar
> meta-index
> mlibwrapper_jai.jar
> sunjce_provider.jar
> sunpkcs11.jar
>
>
>
> I must be missing something simple.
>
> Thanks,
> Dave
> [Message sent by forum member 'dpeckham' (dpeckham)]
>
> http://forums.java.net/jive/thread.jspa?messageID=248340
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail:
> interest-help@jai-imageio.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

dpeckham
Offline
Joined: 2007-12-03

> are you sure that your native clib libraries are
> being picked up?
> you could try printing the result of
> System.getProperty("java.library.path") for example.

Mike, thanks alot. That proved the be the correct tip. All of the ".so" files were in i386, but it turns out that this box is running AMD64. So, I just reinstalled the correct AMD64 versions of jai and jai_imageio and it works fine:

$ java -cp . JPEGTestCase
java.library path=/cp/jdk1.6.0_03/jre/lib/amd64/server:/cp/jdk1.6.0_03/jre/lib/amd64:/cp/jdk1.6.0_03/jre/../lib/amd64:/usr/java/packages/lib/amd64:/lib:/usr/lib
--- com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReader ---
--- com.sun.imageio.plugins.jpeg.JPEGImageReader ---

Thanks!
Dave

James Cheng

> Thanks! I had mixed clib and mlib. I was able to run the program and got:
>
> --- com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReader ---
> javax.imageio.IIOException: Unsupported Image Type
> at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:889)
> at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:864)
> at javax.imageio.ImageReader.read(ImageReader.java:923)
> at com.mobiletech.imageconverter.tests.JPEGTestCase.main(JPEGTestCase.java:30)
> --- com.sun.imageio.plugins.jpeg.JPEGImageReader ---

This looks a bit odd. The line immdediate above appeared ahead of the stack trace
in my test.

> --- codecLib is available ---
>
> So I have the libs, but can still not read the image. and this test case works for you ?

Yeah, the jar and dll files seem to have been found, and the CLibJPEGImageReader
seems to be working. If you really want to see the decoded image, the following
test case might be helpful:


import java.awt.image.BufferedImage;
import java.io.FileInputStream;
import java.util.Iterator;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

import javax.imageio.ImageIO;
import javax.imageio.ImageReader;
import javax.imageio.stream.ImageInputStream;

public class JPEGTestCase extends JPanel
implements ActionListener {
protected JButton b;

public JPEGTestCase() {
try {
FileInputStream imageStream = new
FileInputStream("./jpegErrorImage2.jpg");
// replace this with the path of the image
ImageInputStream iis = null;
ImageReader reader = null;

iis = ImageIO.createImageInputStream(imageStream);

Iterator readers = ImageIO.getImageReaders(iis);
for (;; readers.hasNext()) {
reader = (ImageReader)readers.next();
System.out.println("--- " + reader.getClass().getName() +
" ---");
iis.mark();
reader.setInput(iis, false);
BufferedImage image = reader.read(0);
ImageIcon icon = new ImageIcon(image);
b = new JButton("", icon);
add(b);
iis.reset();
// break;
}
} catch(Exception e){
e.printStackTrace();
}

if (com.sun.medialib.codec.jiio.Util.isCodecLibAvailable()) {
System.out.println("--- codecLib is available ---");
} else {
System.out.println("!!! codecLib is NOT available !!!");
}
}

public void actionPerformed(ActionEvent e) {
}

public static void main(String [] args){
JFrame frame = new JFrame("JPEGTestCase");
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});

frame.getContentPane().add(new JPEGTestCase(), BorderLayout.CENTER);
frame.pack();
frame.setVisible(true);
}
}

-James

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

aryland
Offline
Joined: 2006-04-22

I realize I had not looked close eanough on your scenario, I assumed it was the same as mine except it posted the information about the library. I just saw the exception and assumed it didnt work.

Now it works fine for me with this version of ImageIO.

Thanks a lot for taking the time, you have been a big help.

> > Thanks! I had mixed clib and mlib. I was able to
> run the program and got:
> >
> > ---
> com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageRe
> ader ---
> > javax.imageio.IIOException: Unsupported Image Type
> > at
> com.sun.imageio.plugins.jpeg.JPEGImageReader.readInter
> nal(JPEGImageReader.java:889)
> > at
> com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEG
> ImageReader.java:864)
> > at
> javax.imageio.ImageReader.read(ImageReader.java:923)
> > at
> com.mobiletech.imageconverter.tests.JPEGTestCase.main(
> JPEGTestCase.java:30)
> > --- com.sun.imageio.plugins.jpeg.JPEGImageReader
> ---
>
> This looks a bit odd. The line immdediate above
> appeared ahead of the stack trace
> in my test.
>
> > --- codecLib is available ---
> >
> > So I have the libs, but can still not read the
> image. and this test case works for you ?
>
> Yeah, the jar and dll files seem to have been found,
> and the CLibJPEGImageReader
> seems to be working. If you really want to see the
> decoded image, the following
> test case might be helpful:
>
>
> import java.awt.image.BufferedImage;
> import java.io.FileInputStream;
> import java.util.Iterator;
> import java.awt.*;
> import java.awt.event.*;
> import javax.swing.*;
>
> import javax.imageio.ImageIO;
> import javax.imageio.ImageReader;
> import javax.imageio.stream.ImageInputStream;
>
> public class JPEGTestCase extends JPanel
> implements ActionListener {
> protected JButton b;
>
> public JPEGTestCase() {
> try {
> FileInputStream imageStream = new
> FileInputStream("./jpegErrorImage2.jpg");
> // replace this with the path of the image
> ImageInputStream iis = null;
> ImageReader reader = null;
>
> iis =
> iis = ImageIO.createImageInputStream(imageStream);
>
> Iterator readers = ImageIO.getImageReaders(iis);
> for (;; readers.hasNext()) {
> reader = (ImageReader)readers.next();
> System.out.println("--- " +
> + reader.getClass().getName() +
> " ---");
> iis.mark();
> reader.setInput(iis, false);
> BufferedImage image = reader.read(0);
> ImageIcon icon = new ImageIcon(image);
> b = new JButton("", icon);
> add(b);
> iis.reset();
> // break;
> }
> } catch(Exception e){
> e.printStackTrace();
> }
>
> if
> f
> (com.sun.medialib.codec.jiio.Util.isCodecLibAvailable(
> )) {
> System.out.println("--- codecLib is available
> lable ---");
> } else {
> System.out.println("!!! codecLib is NOT
> s NOT available !!!");
> }
> }
>
> public void actionPerformed(ActionEvent e) {
> }
>
> public static void main(String [] args){
> JFrame frame = new JFrame("JPEGTestCase");
> frame.addWindowListener(new WindowAdapter() {
> public void windowClosing(WindowEvent e) {
> System.exit(0);
> }
> });
>
> frame.getContentPane().add(new
> .add(new JPEGTestCase(), BorderLayout.CENTER);
> frame.pack();
> frame.setVisible(true);
> }
> }
>

>
> -James
>
> ------------------------------------------------------
> ---------------
> To unsubscribe, e-mail:
> interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail:
> interest-help@jai-imageio.dev.java.net

Brian Burkhalter

It is readable by JAI-Image I/O Tools, at least my version. It is *not*
readable by the J2SE JPEG reader however.

The image is indeed buggy: it is a YCCK image but has a JFIF APP0 marker. JFIF
images are by definition either grayscale or YCbCr.

Brian

On Sat, 22 Apr 2006, jai-imageio@javadesktop.org wrote:

> I have come across a JPEG image that ImageIO will not load, this is surely due to some irregularity in the image, but since this image will load in most other applications, it still can be viewed as a bug in my code, which is using ImageIO.
>
> I have filtered the image to try and get it to load and I have discovered that the problematic header segment is the App14 segment, There is also a large ICC profile in the image, but that can be filtered out.
>
> In the image I am using in this test case, I have filtered out all the headers except the App14 header. If this header is filtered away, then the image will load, but the colors will be completely wrong as a result.
>
> ImageIO reports this image as unsupported, there must be something strange in the metadata but I cannot debug this since it is done by native code and calledback with the
> private void setImageData(int width,
> int height,
> int colorSpaceCode,
> int outColorSpaceCode,
> int numComponents,
> byte [] iccData);
> method...
>
> The problem is that the public Iterator getImageTypes(int imageIndex); method returns an empty iterator because the colorSpaceCode doesnt match anything in the switch case.
>
> I am wondering if there is something that can be done so that this image can be loaded despite the irregularities in the image.
>
> The image:
> http://quickdump.com/files/1002788029.html
>
> Case that tries to load this image
>
> mport java.awt.image.BufferedImage;
> import java.io.FileInputStream;
> import java.util.Iterator;
>
> import javax.imageio.ImageIO;
> import javax.imageio.ImageReader;
> import javax.imageio.stream.ImageInputStream;
>
> public class JPEGTestCase {
> public static void main(String [] args){
> try {
> FileInputStream imageStream = new
> FileInputStream("c:/temp/jpegErrorImage2.jpg");
> // replace this with the path of the image
> ImageInputStream iis = null;
> ImageReader reader = null;
>
> iis = ImageIO.createImageInputStream(imageStream);
>
> Iterator readers = ImageIO.getImageReaders(iis);
> reader = (ImageReader)readers.next();
> reader.setInput(iis,false);
>
> BufferedImage image = reader.read(0);
> } catch(Exception e){
> e.printStackTrace();
> }
>
> }
> }
> [Message sent by forum member 'aryland' (aryland)]
>
> http://forums.java.net/jive/thread.jspa?messageID=106712
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-imageio.dev.java.net
>
>

----------------
Brian Burkhalter
Java Media, Imaging, and Graphics
Sun Microsystems, Inc.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

aryland
Offline
Joined: 2006-04-22

It is readable? That is indeed good news, so this means I am using the J2SE JPEG reader? I am not sure how it is connected, to be frank. I do have both the J2SE 5.0 sdk and the jai_imageio.jar in my classpath. If the code I posted is not using imageio like it should, could you please tell me how I should change the imports to use ImageIO instead?

Brian Burkhalter

For the JAI-Image I/O JPEG plug-ins to work you need also to have the native
libraries on the library search path. Please refer to the installation
instructions for the details.

You might need to get the most recent daily build for this image to work. We
have been doing a lot of cleanup in the JPEG reader. Some of this work is not
checked in but should be some time today. Therefore it will at least be
available in tomorrow's daily build.

Brian

On Mon, 24 Apr 2006, jai-imageio@javadesktop.org wrote:

> It is readable? That is indeed good news, so this means I am using the J2SE JPEG reader? I am not sure how it is connected, to be frank. I do have both the J2SE 5.0 sdk and the jai_imageio.jar in my classpath. If the code I posted is not using imageio like it should, could you please tell me how I should change the imports to use ImageIO instead?

----------------
Brian Burkhalter
Java Media, Imaging, and Graphics
Sun Microsystems, Inc.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

aryland
Offline
Joined: 2006-04-22

I tried downloading 24th April build, added the bin folder containing the .dll to windows path and replaced my jar with the one in the zip file.

After that the image still does not work, assuming how I installed it was correct, I can try the April 25th build tomorrow.

Brian Burkhalter

Better yet, try the stable build 1.1-dr-b03 just posted.

Brian

On Mon, 24 Apr 2006, jai-imageio@javadesktop.org wrote:

> I tried downloading 24th April build, added the bin folder containing the .dll to windows path and replaced my jar with the one in the zip file.
>
> After that the image still does not work, assuming how I installed it was correct, I can try the April 25th build tomorrow.
> [Message sent by forum member 'aryland' (aryland)]
>
> http://forums.java.net/jive/thread.jspa?messageID=107228

----------------
Brian Burkhalter
Java Media, Imaging, and Graphics
Sun Microsystems, Inc.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

aryland
Offline
Joined: 2006-04-22

I did, but still the same exception. Im not sure tho, if the native metods are being run, tho I get no warning message that they cannot be found. Is there a way to check which method it is using?

But wait, the ImageReader class that cannot load the image is in rt.jar of my JDK. So this is not the ImageReader that should be reading the image, correct? How do I get the right one to try to read the image?

The class that is reading the image now is:
@(#)JPEGImageReader.java 1.49 04/03/29
package com.sun.imageio.plugins.jpeg.JPEGImageReader;

> Better yet, try the stable build 1.1-dr-b03 just
> posted.
>
> Brian
>
> On Mon, 24 Apr 2006, jai-imageio@javadesktop.org
> wrote:
>
> > I tried downloading 24th April build, added the bin
> folder containing the .dll to windows path and
> replaced my jar with the one in the zip file.
> >
> > After that the image still does not work, assuming
> how I installed it was correct, I can try the April
> 25th build tomorrow.
> > [Message sent by forum member 'aryland' (aryland)]
> >
> >
> http://forums.java.net/jive/thread.jspa?messageID=1072
> 28
>
> ----------------
> Brian Burkhalter
> Java Media, Imaging, and Graphics
> Sun Microsystems, Inc.
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~~~~~~~~~~
> This email message is for the sole use of the
> intended recipient(s)
> and may contain confidential and privileged
> information. Any
> unauthorized review, use, disclosure or distribution
> is prohibited.
> If you are not the intended recipient, please contact
> the sender by
> reply email and destroy all copies of the original
> message.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~~~~~~~~~~
>
> ------------------------------------------------------
> ---------------
> To unsubscribe, e-mail:
> interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail:
> interest-help@jai-imageio.dev.java.net

Marc Boscher

You can also place the .dll in the bin or runtime folder of your
application. Java will automatically find it. Otherwise you can set the VM
argument -Djava.library.path="folder where dlls are". Both the working
runtime directory and VM arguments are set in the run configuration dialog
of eclipse.

I believe that if you get no "Could not find mediaLib accelerator wrapper
classes. Continuing in pure Java mode." message then the native library has
been found.

Cheers!

Marc

-----Original Message-----
From: jai-imageio@javadesktop.org [mailto:jai-imageio@javadesktop.org]
Sent: April 24, 2006 10:20 PM
To: interest@jai-imageio.dev.java.net
Subject: Re: [JAI-IMAGEIO] JPEG Image reported as unsupported by ImageIO

I did, but still the same exception. Im not sure tho, if the native metods
are being run, tho I get no warning message that they cannot be found. Is
there a way to check which method it is using?

But wait, the ImageReader class that cannot load the image is in rt.jar of
my JDK. So this is not the ImageReader that should be reading the image,
correct? How do I get the right one to try to read the image?

The class that is reading the image now is:
@(#)JPEGImageReader.java 1.49 04/03/29
package com.sun.imageio.plugins.jpeg.JPEGImageReader;

> Better yet, try the stable build 1.1-dr-b03 just
> posted.
>
> Brian
>
> On Mon, 24 Apr 2006, jai-imageio@javadesktop.org
> wrote:
>
> > I tried downloading 24th April build, added the bin
> folder containing the .dll to windows path and
> replaced my jar with the one in the zip file.
> >
> > After that the image still does not work, assuming
> how I installed it was correct, I can try the April
> 25th build tomorrow.
> > [Message sent by forum member 'aryland' (aryland)]
> >
> >
> http://forums.java.net/jive/thread.jspa?messageID=1072
> 28
>
> ----------------
> Brian Burkhalter
> Java Media, Imaging, and Graphics
> Sun Microsystems, Inc.
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~~~~~~~~~~
> This email message is for the sole use of the
> intended recipient(s)
> and may contain confidential and privileged
> information. Any
> unauthorized review, use, disclosure or distribution
> is prohibited.
> If you are not the intended recipient, please contact
> the sender by
> reply email and destroy all copies of the original
> message.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~~~~~~~~~~
>
> ------------------------------------------------------
> ---------------
> To unsubscribe, e-mail:
> interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail:
> interest-help@jai-imageio.dev.java.net
[Message sent by forum member 'aryland' (aryland)]

http://forums.java.net/jive/thread.jspa?messageID=107432

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

aryland
Offline
Joined: 2006-04-22

I now deleted and reinstalled my Java SDK, I got the latest ImageIO build and have the following set:

Path variable in windows enviroment, in eclipse global enviroment and run envoriment.

The dll files clib_jiio.dll, clib_jiio_sse2.dll and clib_jiio_util.dll placed java SDK bin and JRE bin and in my project's bin folder.

The VM argument -Djava.library.path="folder where dlls are" set in eclipse.

I dont get any warning that mediaLib could not be found. But I never got that when running this piece of code, I get that when running other code that uses JAI though.

I cant help but wonder if the wrong classes get run, the class that casts the exception is ImageReader in
javax.imageio.IIOException: Unsupported Image Type at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:889)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:864)
at javax.imageio.ImageReader.read(ImageReader.java:923)

Is located in rt.jar from the Java SDK folder. Is this correct? If this image works for Brian then it should work for me too...

> You can also place the .dll in the bin or runtime
> folder of your
> application. Java will automatically find it.
> Otherwise you can set the VM
> argument -Djava.library.path="folder where dlls are".
> Both the working
> runtime directory and VM arguments are set in the run
> configuration dialog
> of eclipse.
>
> I believe that if you get no "Could not find mediaLib
> accelerator wrapper
> classes. Continuing in pure Java mode." message then
> the native library has
> been found.
>
> Cheers!
>
> Marc
>
> -----Original Message-----
> From: jai-imageio@javadesktop.org
> [mailto:jai-imageio@javadesktop.org]
> Sent: April 24, 2006 10:20 PM
> To: interest@jai-imageio.dev.java.net
> Subject: Re: [JAI-IMAGEIO] JPEG Image reported as
> unsupported by ImageIO
>
> I did, but still the same exception. Im not sure tho,
> if the native metods
> are being run, tho I get no warning message that they
> cannot be found. Is
> there a way to check which method it is using?
>
> But wait, the ImageReader class that cannot load the
> image is in rt.jar of
> my JDK. So this is not the ImageReader that should be
> reading the image,
> correct? How do I get the right one to try to read
> the image?
>
> The class that is reading the image now is:
> @(#)JPEGImageReader.java 1.49 04/03/29
> package com.sun.imageio.plugins.jpeg.JPEGImageReader;
>
> > Better yet, try the stable build 1.1-dr-b03 just
> > posted.
> >
> > Brian
> >
> > On Mon, 24 Apr 2006, jai-imageio@javadesktop.org
> > wrote:
> >
> > > I tried downloading 24th April build, added the
> bin
> > folder containing the .dll to windows path and
> > replaced my jar with the one in the zip file.
> > >
> > > After that the image still does not work,
> assuming
> > how I installed it was correct, I can try the April
> > 25th build tomorrow.
> > > [Message sent by forum member 'aryland'
> (aryland)]
> > >
> > >
> >
> http://forums.java.net/jive/thread.jspa?messageID=1072
> > 28
> >
> > ----------------
> > Brian Burkhalter
> > Java Media, Imaging, and Graphics
> > Sun Microsystems, Inc.
> >
> >
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > ~~~~~~~~~~~~~
> > This email message is for the sole use of the
> > intended recipient(s)
> > and may contain confidential and privileged
> > information. Any
> > unauthorized review, use, disclosure or
> distribution
> > is prohibited.
> > If you are not the intended recipient, please
> contact
> > the sender by
> > reply email and destroy all copies of the original
> > message.
> >
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > ~~~~~~~~~~~~~
> >
> >
> ------------------------------------------------------
> > ---------------
> > To unsubscribe, e-mail:
> > interest-unsubscribe@jai-imageio.dev.java.net
> > For additional commands, e-mail:
> > interest-help@jai-imageio.dev.java.net
> [Message sent by forum member 'aryland' (aryland)]
>
> http://forums.java.net/jive/thread.jspa?messageID=1074
> 32
>
> ------------------------------------------------------
> ---------------
> To unsubscribe, e-mail:
> interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail:
> interest-help@jai-imageio.dev.java.net
>
>
>
> ------------------------------------------------------
> ---------------
> To unsubscribe, e-mail:
> interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail:
> interest-help@jai-imageio.dev.java.net

Brian Burkhalter

What about jai_imageio.jar and clibwrapper_jiio.jar? The plug-in you are
picking up is the core Java SE JPEG reader which cannot handle this image.

Brian

On Tue, 25 Apr 2006, jai-imageio@javadesktop.org wrote:

> I now deleted and reinstalled my Java SDK, I got the latest ImageIO build and have the following set:
>
> Path variable in windows enviroment, in eclipse global enviroment and run envoriment.
>
> The dll files clib_jiio.dll, clib_jiio_sse2.dll and clib_jiio_util.dll placed java SDK bin and JRE bin and in my project's bin folder.
>
> The VM argument -Djava.library.path="folder where dlls are" set in eclipse.
>
> I dont get any warning that mediaLib could not be found. But I never got that when running this piece of code, I get that when running other code that uses JAI though.
>
> I cant help but wonder if the wrong classes get run, the class that casts the exception is ImageReader in
> javax.imageio.IIOException: Unsupported Image Type at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:889)
> at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:864)
> at javax.imageio.ImageReader.read(ImageReader.java:923)
>
> Is located in rt.jar from the Java SDK folder. Is this correct? If this image works for Brian then it should work for me too...
>
>
>> You can also place the .dll in the bin or runtime
>> folder of your
>> application. Java will automatically find it.
>> Otherwise you can set the VM
>> argument -Djava.library.path="folder where dlls are".
>> Both the working
>> runtime directory and VM arguments are set in the run
>> configuration dialog
>> of eclipse.
>>
>> I believe that if you get no "Could not find mediaLib
>> accelerator wrapper
>> classes. Continuing in pure Java mode." message then
>> the native library has
>> been found.
>>
>> Cheers!
>>
>> Marc
>>
>> -----Original Message-----
>> From: jai-imageio@javadesktop.org
>> [mailto:jai-imageio@javadesktop.org]
>> Sent: April 24, 2006 10:20 PM
>> To: interest@jai-imageio.dev.java.net
>> Subject: Re: [JAI-IMAGEIO] JPEG Image reported as
>> unsupported by ImageIO
>>
>> I did, but still the same exception. Im not sure tho,
>> if the native metods
>> are being run, tho I get no warning message that they
>> cannot be found. Is
>> there a way to check which method it is using?
>>
>> But wait, the ImageReader class that cannot load the
>> image is in rt.jar of
>> my JDK. So this is not the ImageReader that should be
>> reading the image,
>> correct? How do I get the right one to try to read
>> the image?
>>
>> The class that is reading the image now is:
>> @(#)JPEGImageReader.java 1.49 04/03/29
>> package com.sun.imageio.plugins.jpeg.JPEGImageReader;
>>
>>> Better yet, try the stable build 1.1-dr-b03 just
>>> posted.
>>>
>>> Brian
>>>
>>> On Mon, 24 Apr 2006, jai-imageio@javadesktop.org
>>> wrote:
>>>
>>>> I tried downloading 24th April build, added the
>> bin
>>> folder containing the .dll to windows path and
>>> replaced my jar with the one in the zip file.
>>>>
>>>> After that the image still does not work,
>> assuming
>>> how I installed it was correct, I can try the April
>>> 25th build tomorrow.
>>>> [Message sent by forum member 'aryland'
>> (aryland)]
>>>>
>>>>
>>>
>> http://forums.java.net/jive/thread.jspa?messageID=1072
>>> 28
>>>
>>> ----------------
>>> Brian Burkhalter
>>> Java Media, Imaging, and Graphics
>>> Sun Microsystems, Inc.
>>>
>>>
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> ~~~~~~~~~~~~~
>>> This email message is for the sole use of the
>>> intended recipient(s)
>>> and may contain confidential and privileged
>>> information. Any
>>> unauthorized review, use, disclosure or
>> distribution
>>> is prohibited.
>>> If you are not the intended recipient, please
>> contact
>>> the sender by
>>> reply email and destroy all copies of the original
>>> message.
>>>
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> ~~~~~~~~~~~~~
>>>
>>>
>> ------------------------------------------------------
>>> ---------------
>>> To unsubscribe, e-mail:
>>> interest-unsubscribe@jai-imageio.dev.java.net
>>> For additional commands, e-mail:
>>> interest-help@jai-imageio.dev.java.net
>> [Message sent by forum member 'aryland' (aryland)]
>>
>> http://forums.java.net/jive/thread.jspa?messageID=1074
>> 32
>>
>> ------------------------------------------------------
>> ---------------
>> To unsubscribe, e-mail:
>> interest-unsubscribe@jai-imageio.dev.java.net
>> For additional commands, e-mail:
>> interest-help@jai-imageio.dev.java.net
>>
>>
>>
>> ------------------------------------------------------
>> ---------------
>> To unsubscribe, e-mail:
>> interest-unsubscribe@jai-imageio.dev.java.net
>> For additional commands, e-mail:
>> interest-help@jai-imageio.dev.java.net
> [Message sent by forum member 'aryland' (aryland)]
>
> http://forums.java.net/jive/thread.jspa?messageID=107686
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-imageio.dev.java.net
>
>

----------------
Brian Burkhalter
Java Media, Imaging, and Graphics
Sun Microsystems, Inc.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

aryland
Offline
Joined: 2006-04-22

They have been put both in the SDK and JRE /lib/ext folders and have been included to the eclipse project in the project lib folder.

Brian Burkhalter

If you have the jar files in jre/lib/ext and (on Windows) the .dll files in
jre/bin and you are picking up jre/bin/java as your VM executable then things
should work. Maybe you're not picking up the right java? I can't say anything
about Eclipse.

Brian

On Tue, 25 Apr 2006, jai-imageio@javadesktop.org wrote:

> They have been put both in the SDK and JRE /lib/ext folders and have been included to the eclipse project in the project lib folder.
> [Message sent by forum member 'aryland' (aryland)]

----------------
Brian Burkhalter
Java Media, Imaging, and Graphics
Sun Microsystems, Inc.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

James Cheng

I wonder if this has anything to do with the Image I/O plugin
registry. I have modified the original test case as follows
for checking available JPEG readers and codecLib's availability:


import java.awt.image.BufferedImage;
import java.io.FileInputStream;
import java.util.Iterator;

import javax.imageio.ImageIO;
import javax.imageio.ImageReader;
import javax.imageio.stream.ImageInputStream;

public class JPEGTestCase {
public static void main(String [] args){
try {
FileInputStream imageStream = new
FileInputStream("./jpegErrorImage2.jpg");
// replace this with the path of the image
ImageInputStream iis = null;
ImageReader reader = null;

iis = ImageIO.createImageInputStream(imageStream);

Iterator readers = ImageIO.getImageReaders(iis);
for (;; readers.hasNext()) {
reader = (ImageReader)readers.next();
System.out.println("--- " + reader.getClass().getName() +
" ---");
iis.mark();
reader.setInput(iis, false);
BufferedImage image = reader.read(0);
iis.reset();
}
} catch(Exception e){
e.printStackTrace();
}

if (com.sun.medialib.codec.jiio.Util.isCodecLibAvailable()) {
System.out.println("--- codecLib is available ---");
} else {
System.out.println("!!! codecLib is NOT available !!!");
}
}
}

In normal situation, it prints out something like the following:

--- com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReader ---
--- com.sun.imageio.plugins.jpeg.JPEGImageReader ---
javax.imageio.IIOException: Unsupported Image Type
at ...
--- codecLib is available ---

HTH,
-James

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

aryland
Offline
Joined: 2006-04-22

Could this be a clue, I pasted your code but I cannot find the package com.sun.medialib.codec
I have the com.sun.medialib package, but it does not contain codec.

Which .jar is this package found in? I googled for it but didnt find anything

> I wonder if this has anything to do with the Image
> I/O plugin
> registry. I have modified the original test case as
> follows
> for checking available JPEG readers and codecLib's
> availability:
>
>
> import java.awt.image.BufferedImage;
> import java.io.FileInputStream;
> import java.util.Iterator;
>
> import javax.imageio.ImageIO;
> import javax.imageio.ImageReader;
> import javax.imageio.stream.ImageInputStream;
>
> public class JPEGTestCase {
> public static void main(String [] args){
> try {
> FileInputStream imageStream = new
> FileInputStream("./jpegErrorImage2.jpg");
> // replace this with the path of the image
> ImageInputStream iis = null;
> ImageReader reader = null;
>
> iis =
> iis = ImageIO.createImageInputStream(imageStream);
>
> Iterator readers = ImageIO.getImageReaders(iis);
> for (;; readers.hasNext()) {
> reader = (ImageReader)readers.next();
> System.out.println("--- " +
> + reader.getClass().getName() +
> " ---");
> iis.mark();
> reader.setInput(iis, false);
> BufferedImage image = reader.read(0);
> iis.reset();
> }
> } catch(Exception e){
> e.printStackTrace();
> }
>
> if
> f
> (com.sun.medialib.codec.jiio.Util.isCodecLibAvailable(
> )) {
> System.out.println("--- codecLib is available
> lable ---");
> } else {
> System.out.println("!!! codecLib is NOT
> s NOT available !!!");
> }
> }
> }
>

>
> In normal situation, it prints out something like the
> following:
>
> ---
> com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageRe
> ader ---
> --- com.sun.imageio.plugins.jpeg.JPEGImageReader ---
> javax.imageio.IIOException: Unsupported Image Type
> at ...
> --- codecLib is available ---
>
> HTH,
> -James
>
> ------------------------------------------------------
> ---------------
> To unsubscribe, e-mail:
> interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail:
> interest-help@jai-imageio.dev.java.net

James Cheng

> Could this be a clue, I pasted your code but I cannot find the package com.sun.medialib.codec
> I have the com.sun.medialib package, but it does not contain codec.
>
> Which .jar is this package found in? I googled for it but didnt find anything

clibwrapper_jiio.jar

-James

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

aryland
Offline
Joined: 2006-04-22

Thanks! I had mixed clib and mlib. I was able to run the program and got:

--- com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReader ---
javax.imageio.IIOException: Unsupported Image Type
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:889)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:864)
at javax.imageio.ImageReader.read(ImageReader.java:923)
at com.mobiletech.imageconverter.tests.JPEGTestCase.main(JPEGTestCase.java:30)
--- com.sun.imageio.plugins.jpeg.JPEGImageReader ---
--- codecLib is available ---

So I have the libs, but can still not read the image. and this test case works for you ?

aryland
Offline
Joined: 2006-04-22

Just to note that I am using jar and dll from jai-imageio-1_1-dr-b03-lib-windows-i586.zip

> Thanks! I had mixed clib and mlib. I was able to run
> the program and got:
>
> ---
> com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageRe
> ader ---
> javax.imageio.IIOException: Unsupported Image Type
> at
> t
> com.sun.imageio.plugins.jpeg.JPEGImageReader.readInter
> nal(JPEGImageReader.java:889)
> at
> t
> com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEG
> ImageReader.java:864)
> at
> t
> javax.imageio.ImageReader.read(ImageReader.java:923)
> at
> t
> com.mobiletech.imageconverter.tests.JPEGTestCase.main(
> JPEGTestCase.java:30)
> --- com.sun.imageio.plugins.jpeg.JPEGImageReader ---
> --- codecLib is available ---
>
> So I have the libs, but can still not read the image.
> and this test case works for you ?