Getting the pixel value of a TIFF image in Java

偶尔善良 提交于 2019-12-08 02:03:12

问题


The ImageIO package doesn't work with .tif images and I cannot create a BufferedImage (Class I'm more familiar with) from a .tif file.

How do I easily get the pixel value of a TIFF image in Java? How can I do it FAST?

I'm not experienced with image processing and some sample code would be greatly appreciated!

Thanks!


回答1:


You will need the Java Advanced Imaging API: JAI in order to work with TIFF images.

From the JAI API description:

TIFF

In addition to the baseline specification, the encoder and decoder support PackBits, modified Huffman and CCITT bilevel encodings (fax), JPEG-in-TIFF (per TIFF Technical Note #2), and DEFLATE compression schemes, can handle images with 16- and 32-bit integral samples and 32-bit floating point samples, and can read and write tiled images of all supported data types. The decoder in addition can decompress LZW-compressed imagery.

Additional features may be addressed in the future.

A single page of a multi-page TIFF file may loaded most easily by using the page parameter with the "TIFF" operator which is documented in the class comments of javax.media.jai.operator.TIFFDescriptor. A code sample is included here to show a means of loading a single page of a multi-page TIFF file using the ancillary codec classes directly.

Try out some of these tutorials.



来源:https://stackoverflow.com/questions/7421904/getting-the-pixel-value-of-a-tiff-image-in-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!