Skip to main content

Problem in Reading Big TIFF file

2 replies [Last post]
rkmishra
Offline
Joined: 2010-03-20

I am reading tiff file using
PlanarImage image = JAI.create("fileload", filename);
This is working well for the image size up to 2 GB. However, if read an tiff image of size more than 3 GB it is giving following error:

Error: Cannot decode the image for the type :
Occurs in: com.sun.media.jai.opimage.CodecRIFUtil
java.io.IOException: pos < 0.
at com.sun.media.jai.codec.FileSeekableStream.seek(FileSeekableStream.java:107)
at com.sun.media.jai.codec.TIFFDirectory.initialize(TIFFDirectory.java:211)
at com.sun.media.jai.codec.TIFFDirectory.(TIFFDirectory.java:117)
at com.sun.media.jai.codecimpl.TIFFImage.(TIFFImage.java:312)
at com.sun.media.jai.codecimpl.TIFFImageDecoder.decodeAsRenderedImage(TIFFImageDecoder.java:107)
at com.sun.media.jai.opimage.CodecRIFUtil.create(CodecRIFUtil.java:88)
at com.sun.media.jai.opimage.TIFFRIF.create(TIFFRIF.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
pentath
Offline
Joined: 2009-08-04

If you get the jai-imageio library and use the ImageRead / ImageWrite operators instead, you may get closer to the 4 GB limit for normal TIFF files -- but really, if you want to work with big TIFF files, you need a TIFF codec that understands the BigTIFF extensions to the TIFF standard, which the normal Java TIFF codec (and therefore the JAI TIFF codec you are using) does not.

One thing you might look at is the BigTIFF codec that imageio-ext project put together:

http://geo-solutions.blogspot.com/2010/04/bigtiff-support-in-geotoolsgeo...

I have used it successfully for working with large satellite images, but note that this is new, alpha software.

rkmishra
Offline
Joined: 2010-03-20

Many thanks !
I have downloaded JAI IO Lib and now ImageRead is working well for Images size up to 4 GB.
Thanks again !