Question

Now I have to do some processing(such as read/save) with some .tif images, but it seems like I can not read or write the images by java. Is there any library can help me for that? And How to used it to read or save the images? Thanks for your answer.

Was it helpful?

Solution

I guess you will need to use the JAI (Java advances imaging package), take a look at this, and see this example

OTHER TIPS

Java Advanced Imaging provides support for TIFF out of the box. Alternately add a Service Provider Interface Jar for TIFF on the run-time class-path of the app. and ImageIO will be able to deal with them (load them at least, it probably won't provide support for 'multi-page' TIFF writing).

Java supports reading and writing jpeg, gif and png by default, using ImageIO. In order to read tiff images, you must use a JAI plugin called jai_imageio.jar. You just put this jar in the classpath and you will be able to read tiff images.

used jai not working now, can't get "com.sun.image". But found another package that works - jdeli. It has a class TiffDecoder, which can be used to decode(read) tiff images with alpha channel to a Buffered image. Then you can write that image using ImageIO.write

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top