tags:

views:

40

answers:

1

I'm brand new to Java Advanced Imaging, and the first stumbling block I've reached is the ability to read in a 12 bit, single band, greyscale JPEG file. I've seen references to it being possible with JAI, but no code or even suggestions about how it should be done. Could someone please help me out with either a helpful link or a short code snippet?

I've been using this tutorial so far, but it hasn't helped me on this issue.

Thanks.

A: 

JAI-ImageIO will register itself into Java's ImageIO api, so you should be able to use it just by having the jai-imageio jars in your classpath an calling the normal ImageIO methods, such as ImageIO.read(file).

The problem with jpeg might be that Java has a default jpeg reader in the IIORegistry, and you may have to select the right one manually using something like ImageIO.getImageReadersForFormatName().

Another thing with the more esoteric formats is that JAI ImageIO usually has two implementations - one pure Java and the other using native binary libraries, so make sure that you include the *lib-wrapper.dll (or whatever suits your particular OS) in the LD_LiBRARY_PATH or have the in the working directory of your program. The native implementation usually supports mode format variants than the pure-java one.

mkadunc