Skip to main content

[JAI-IMAGEIO] Bizarre Problem in Mac OS X

3 replies [Last post]
Anonymous

In the beginning I had this code segment to construct an image from
ByteArrayInputStream:

ByteArrayInputStream bais = new ByteArrayInputStream(img_data);
BufferedImage bi = ImageIO.read(bais);
PlanarImage pi = ImageProcessing.imageToPlanarImage(bi);

It worked under Windows, and the application is launched through
WebStart, however it does not work in Mac OS X. For some bizarre reason,
ImageIO.read(bais) returns NULL.

So I changed my code to the following:

ByteArrayInputStream bais = new ByteArrayInputStream(img_data);
final PlanarImage pi = JAI.create("ImageRead", bais);

Once again, code worked in Windows, but failed in Mac OS X, I get a
runtime error exception, saying that it cannot render the image.

Does anyone know why both code segments do not work in Mac? Thanks in
advance!

George.

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

Reply viewing options

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

Hi George,

> Once again, code worked in Windows, but failed in Mac OS X, I get a
> runtime error exception, saying that it cannot render the image.
>
> Does anyone know why both code segments do not work in Mac?

Are you reading datastreams in JPEG-LOSSLESS or JPEG-LS compression?
The JPEG plugin supporting JPEG-LOSSLESS and JPEG-LS in jai-imageio
uses a native library which is not available on Mac.

The two JPEG 2000 plugins, one uses the native library and the other
uses only pure Java code, behave differently in some cases. On Windows,
the native one is used by default. On Mac, only the pure Java one 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

George Yang

James Cheng wrote:
> Hi George,
>
>> Once again, code worked in Windows, but failed in Mac OS X, I get a
>> runtime error exception, saying that it cannot render the image.
>>
>> Does anyone know why both code segments do not work in Mac?
>
> Are you reading datastreams in JPEG-LOSSLESS or JPEG-LS compression?
> The JPEG plugin supporting JPEG-LOSSLESS and JPEG-LS in jai-imageio
> uses a native library which is not available on Mac.
>
> The two JPEG 2000 plugins, one uses the native library and the other
> uses only pure Java code, behave differently in some cases. On
> Windows, the native one is used by default. On Mac, only the pure
> Java one 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
Hi James,

Thanks for the response. But with the same application, when I run it
locally, it works fine. So could be a WebStart problem on Mac?

George.

---------------------------------------------------------------------
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

> Thanks for the response. But with the same application, when I run it
> locally, it works fine. So could be a WebStart problem on Mac?

It could be. As people have suggested, something like the following
might help your debugging:

System.out.println(reader.getClass().getName());
System.out.println(this.getClass().getClassLoader());

-James

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