JAI: reading in 12-bit JPEG files

I'm new to Java Advanced Imaging, and the first stumbling block I have reached is the ability to read in a 12-bit, single-band greyscale JPEG file. I saw links to this with JAI, but no code, not even suggestions on how to do this. Can someone please help me with a helpful link or a short code snippet?

I used this tutorial , but it didn’t help me.

Thank.

+3
source share
2 answers

JAI-ImageIO will register with the Java ImageIO api, so you can use it simply by using jai-imageio jars in the classpath that invokes the usual ImageIO methods such as ImageIO.read (file).

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

Another thing with more esoteric formats is that JAI ImageIO usually has two implementations - one pure Java and the other using its own binary libraries, so make sure you include * lib-wrapper.dll (or something, what suits your specific OS) in LD_LiBRARY_PATH or in your program’s working directory. A native implementation usually supports mode format options than pure-java.

+1

JPEG 12- JAI + JAI Image I/O.

, JPEG 12bit, mediaLib.

"ImageRead" Image I/O:

byte[] imageBytes = ...
RenderedOp readImage = JAI.create("ImageRead", new MemoryImageInputStream(imageBytes));

FTP, byte[] MemoryImageInputStream, byte[] ImageInputStream ImageInputStreamImpl.

0

Source: https://habr.com/ru/post/1758024/


All Articles