Skip to main content

With or without native libs on runtime

8 replies [Last post]
schalueck
Offline
Joined: 2007-07-26

Hi,
how can I decide whether I want to read a tiff image with or without the native libraries? Currently I have a strange image that decodes fine without the native libs and raises an exeption when I use the native libs. In most cases I need to use the native libs.
Thanks
Elmar

Reply viewing options

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

I guess you didn't read my earlier posting:

http://forums.java.net/jive/thread.jspa?threadID=32040&tstart=0

On Thu, 18 Oct 2007, jai-imageio@javadesktop.org wrote:

> Hi,
> when I use the following code snipplet, I only get one reader instance.
>
> File imageFile = new File(filename);
> FileSeekableStream fss = new FileSeekableStream(imageFile);
> ImageInputStream iis = ImageIO.createImageInputStream(imageFile);
> Iterator readers = ImageIO.getImageReaders(iis);
> ImageReader reader = null;
> while (readers.hasNext()) {
> reader = (ImageReader) readers.next();
> System.out.println("Reader: " + reader.getClass().getName() + " Provider: " + reader.getOriginatingProvider().getPluginClassName());
> }
>
> How do I get two different readers for my tiff image, one native, one non-native?
> [Message sent by forum member 'schalueck' (schalueck)]
>
> http://forums.java.net/jive/thread.jspa?messageID=241123
>
> ---------------------------------------------------------------------
> 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

Nidel, Mike

I don't believe there is a TIFF plugin that uses native libraries.
If you are reading JPEG-in-TIFF, it uses a JPEG reader which may
involve native libraries, but other than that the TIFF reader is Java.

> -----Original Message-----
> From: jai-imageio@javadesktop.org
> [mailto:jai-imageio@javadesktop.org]
> Sent: Friday, October 19, 2007 2:51 AM
> To: interest@jai-imageio.dev.java.net
> Subject: Re: [JAI-IMAGEIO] With or without native libs on runtime
>
> Hi,
> when I use the following code snipplet, I only get one reader
> instance.
>
> File imageFile = new File(filename);
> FileSeekableStream fss = new FileSeekableStream(imageFile);
> ImageInputStream iis = ImageIO.createImageInputStream(imageFile);
> Iterator readers = ImageIO.getImageReaders(iis); ImageReader
> reader = null; while (readers.hasNext()) {
> reader = (ImageReader) readers.next();
> System.out.println("Reader: " +
> reader.getClass().getName() + " Provider: " +
> reader.getOriginatingProvider().getPluginClassName());
> }
>
> How do I get two different readers for my tiff image, one
> native, one non-native?
> [Message sent by forum member 'schalueck' (schalueck)]
>
> http://forums.java.net/jive/thread.jspa?messageID=241123
>
> ---------------------------------------------------------------------
> 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

Right on!

On Fri, 19 Oct 2007, Nidel, Mike wrote:

> I don't believe there is a TIFF plugin that uses native libraries.
> If you are reading JPEG-in-TIFF, it uses a JPEG reader which may
> involve native libraries, but other than that the TIFF reader is Java.
>
>
>> -----Original Message-----
>> From: jai-imageio@javadesktop.org
>> [mailto:jai-imageio@javadesktop.org]
>> Sent: Friday, October 19, 2007 2:51 AM
>> To: interest@jai-imageio.dev.java.net
>> Subject: Re: [JAI-IMAGEIO] With or without native libs on runtime
>>
>> Hi,
>> when I use the following code snipplet, I only get one reader
>> instance.
>>
>> File imageFile = new File(filename);
>> FileSeekableStream fss = new FileSeekableStream(imageFile);
>> ImageInputStream iis = ImageIO.createImageInputStream(imageFile);
>> Iterator readers = ImageIO.getImageReaders(iis); ImageReader
>> reader = null; while (readers.hasNext()) {
>> reader = (ImageReader) readers.next();
>> System.out.println("Reader: " +
>> reader.getClass().getName() + " Provider: " +
>> reader.getOriginatingProvider().getPluginClassName());
>> }
>>
>> How do I get two different readers for my tiff image, one
>> native, one non-native?
>> [Message sent by forum member 'schalueck' (schalueck)]
>>
>> http://forums.java.net/jive/thread.jspa?messageID=241123
>>
>> ---------------------------------------------------------------------
>> 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
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

schalueck
Offline
Joined: 2007-07-26

OK,
I did get it! But the explanation does not help for my original problem, having an image which decodes correctly with the jvm start parameter
-Dcom.sun.media.imageio.disableCodecLib=true,
but it throws an exception when I do not disable the native lib.
So how can I catch the exception and try it correctly? Or is the only solution to attach the incorrect image to get you fix the problem?
I need the native lib approach for performance and other reasons.
Regards,
Elmar

robert engels

You will need to manage the readers manually.

Try with the native, trap any exceptions, if you get an exception use
the non-native reader.

On Oct 17, 2007, at 1:31 AM, jai-imageio@javadesktop.org wrote:

> Hi,
> how can I decide whether I want to read a tiff image with or
> without the native libraries? Currently I have a strange image that
> decodes fine without the native libs and raises an exeption when I
> use the native libs. In most cases I need to use the native libs.
> Thanks
> Elmar
> [Message sent by forum member 'schalueck' (schalueck)]
>
> http://forums.java.net/jive/thread.jspa?messageID=240580
>
> ---------------------------------------------------------------------
> 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

schalueck
Offline
Joined: 2007-07-26

Hi,
when I use the following code snipplet, I only get one reader instance.

File imageFile = new File(filename);
FileSeekableStream fss = new FileSeekableStream(imageFile);
ImageInputStream iis = ImageIO.createImageInputStream(imageFile);
Iterator readers = ImageIO.getImageReaders(iis);
ImageReader reader = null;
while (readers.hasNext()) {
reader = (ImageReader) readers.next();
System.out.println("Reader: " + reader.getClass().getName() + " Provider: " + reader.getOriginatingProvider().getPluginClassName());
}

How do I get two different readers for my tiff image, one native, one non-native?

robert engels

You need to have the imageio tools installed. You also need to be on
a platform that has the native readers (e.g. not OSX).

On Oct 19, 2007, at 1:50 AM, jai-imageio@javadesktop.org wrote:

> Hi,
> when I use the following code snipplet, I only get one reader
> instance.
>
> File imageFile = new File(filename);
> FileSeekableStream fss = new FileSeekableStream(imageFile);
> ImageInputStream iis = ImageIO.createImageInputStream(imageFile);
> Iterator readers = ImageIO.getImageReaders(iis);
> ImageReader reader = null;
> while (readers.hasNext()) {
> reader = (ImageReader) readers.next();
> System.out.println("Reader: " + reader.getClass().getName() + "
> Provider: " + reader.getOriginatingProvider().getPluginClassName());
> }
>
> How do I get two different readers for my tiff image, one native,
> one non-native?
> [Message sent by forum member 'schalueck' (schalueck)]
>
> http://forums.java.net/jive/thread.jspa?messageID=241123
>
> ---------------------------------------------------------------------
> 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

bpb
Offline
Joined: 2004-06-23

This response is absolutely correct but I just wanted to clarify again where native code is used in JAI-IMAGEIO:

* The JPEG reader and writer (including 12-bit DCT, lossless JPEG, and JPEG-LS) and PNG plugins function only when the native code is present.

* JPEG2000 has both native and Java reader and writer plugins which are entirely independent of one another.

* The TIFF reader and writer plugins are written in Java but use the native libraries in two ways:
1) for reading and writing bilevel encodings (RLE, T.4, T.6) the native libraries are invoked via their wrapper methods;
2) for JPEG-in-TIFF compression and decompression the JAI-IMAGEIO JPEG plugins may be used if available but are invoked via the javax.imageio interfaces, i.e., not via wrapper method calls. TIFF does not lose any functionality when the JAI-IMAGEIO native libraries are not available.

> You will need to manage the readers manually.
>
> Try with the native, trap any exceptions, if you get
> an exception use
> the non-native reader.
>
> On Oct 17, 2007, at 1:31 AM,
> jai-imageio@javadesktop.org wrote:
>
> > Hi,
> > how can I decide whether I want to read a tiff
> image with or
> > without the native libraries? Currently I have a
> strange image that
> > decodes fine without the native libs and raises an
> exeption when I
> > use the native libs. In most cases I need to use
> the native libs.
> > Thanks
> > Elmar
> > [Message sent by forum member 'schalueck'
> (schalueck)]
> >
> >
> http://forums.java.net/jive/thread.jspa?messageID=2405
> 80
> >
> >
> ------------------------------------------------------
> ---------------
> > 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