Error loading Large tiff file "Unable to read file. Exception: -16777215"

When I try to load a large tiff file (4 GB in size), I get this error
What does error code mean and where can i find more information about error codes like this.

library: aspose-imaging-23.11-jdk16

code

TiffImage multiPageImage = (TiffImage) Image.load("filepath");
TiffFrame[] frames = multiPageImage.getFrames();

Stacktrace

at com.test.FilePreProcessor.preprocessFile(FilePreProcessor.java:84) ~[main/:na]
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:352) ~[spring-aop-6.1.1.jar:6.1.1]
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:713) ~[spring-aop-6.1.1.jar:6.1.1]
	at com.test.DigipathScanFilePreProcessor$$SpringCGLIB$$0.preprocessFile(<generated>) ~[main/:na]
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]
	at org.apache.camel.support.ObjectHelper.invokeMethodSafe(ObjectHelper.java:452) ~[camel-support-4.2.0.jar:4.2.0]
	at org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:493) ~[camel-bean-4.2.0.jar:4.2.0]
	at org.apache.camel.component.bean.MethodInfo$1.doProceed(MethodInfo.java:315) ~[camel-bean-4.2.0.jar:4.2.0]
	at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:285) ~[camel-bean-4.2.0.jar:4.2.0]
	at org.apache.camel.component.bean.AbstractBeanProcessor.useMethodInvocation(AbstractBeanProcessor.java:122) ~[camel-bean-4.2.0.jar:4.2.0]
	at org.apache.camel.component.bean.AbstractBeanProcessor.process(AbstractBeanProcessor.java:88) ~[camel-bean-4.2.0.jar:4.2.0]
	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:81) ~[camel-bean-4.2.0.jar:4.2.0]
	at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.doRun(RedeliveryErrorHandler.java:838) ~[camel-core-processor-4.2.0.jar:4.2.0]
	at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.run(RedeliveryErrorHandler.java:746) ~[camel-core-processor-4.2.0.jar:4.2.0]
	at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.doRun(DefaultReactiveExecutor.java:199) ~[camel-base-engine-4.2.0.jar:4.2.0]
	at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.executeReactiveWork(DefaultReactiveExecutor.java:189) ~[camel-base-engine-4.2.0.jar:4.2.0]
	at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.tryExecuteReactiveWork(DefaultReactiveExecutor.java:166) ~[camel-base-engine-4.2.0.jar:4.2.0]
	at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:148) ~[camel-base-engine-4.2.0.jar:4.2.0]
	at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:59) ~[camel-base-engine-4.2.0.jar:4.2.0]
	at org.apache.camel.processor.Pipeline.process(Pipeline.java:163) ~[camel-core-processor-4.2.0.jar:4.2.0]
	at org.apache.camel.impl.engine.CamelInternalProcessor.processNonTransacted(CamelInternalProcessor.java:354) ~[camel-base-engine-4.2.0.jar:4.2.0]
	at org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:330) ~[camel-base-engine-4.2.0.jar:4.2.0]
	at org.apache.camel.component.seda.SedaConsumer.sendToConsumers(SedaConsumer.java:267) ~[camel-seda-4.2.0.jar:4.2.0]
	at org.apache.camel.component.seda.SedaConsumer.doRun(SedaConsumer.java:186) ~[camel-seda-4.2.0.jar:4.2.0]
	at org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:129) ~[camel-seda-4.2.0.jar:4.2.0]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[na:na]
	at java.base/java.lang.Thread.run(Thread.java:1583) ~[na:na]
Caused by: com.aspose.imaging.coreexceptions.ImageLoadException: Unable to read file. Exception: -16777215
	at com.aspose.imaging.internal.ja.Q.a(Unknown Source) ~[aspose-imaging-23.11-jdk16.jar:23.11]
	at com.aspose.imaging.internal.ja.Q.a(Unknown Source) ~[aspose-imaging-23.11-jdk16.jar:23.11]
	at com.aspose.imaging.internal.ja.d.load(Unknown Source) ~[aspose-imaging-23.11-jdk16.jar:23.11]
	at com.aspose.imaging.Image.a(Unknown Source) ~[aspose-imaging-23.11-jdk16.jar:23.11]
	at com.aspose.imaging.Image.load(Unknown Source) ~[aspose-imaging-23.11-jdk16.jar:23.11]```

@suresh.sivanantham , is it possible to share a link to the image? So we can reproduce this error and provide a feedback.

Hi @Denis.Sitko - Thanks for your reply.
The image is confidential hence I cannot share it here. I will try to reproduce with other files I could share.

Meanwhile, Do you have any recommendations on digging deeper into this error from my side.?
(note - I have tested with several 1.5GiB file which works fine, Only a couple of 4 GB files fails with the same error)

suresh.sivanantham ,
First of all you should verify the image consistency (if it is a valid loadable image). As for TIFF it must contain specific header and data structure. TIFF is also limited to 4.4 Gb size, so in order to exceed this limit it has to be a BigTiff image.
Hope some of this helps!

got it.
I was able to verify the TIFF headers with couple tools (exiftool, qupath viewer) - TIFF file seems to be fine, and the file size is 4.0 GiB and I tried with BigTiffImage multiPageImage = (BigTiffImage) Image.load(fileObj.getAbsoluteFilePath()); and received the same error.

I will keep digging and I am also going to try to de-identify the image and share. If you happen to have any additional recommendations let me know.

tags extracted from exiftool

Image Width                     : 88064
Image Height                    : 166912
Bits Per Sample                 : 8 8 8
Compression                     : JPEG
Photometric Interpretation      : YCbCr
Image Description               : <?xml version="1.0" encoding="UTF-8"?><OME xmlns="http://www.openmicroscopy.org/Schemas/OME/2016-06" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openmicroscopy.org/Schemas/OME/2016-06 http://www.openmicroscopy.org/Schemas/OME/2016-06/ome.xsd" UUID="urn:uuid:38243c1e-802a-11ed-b4dd-f02f74f842dd"  Creator="tifffile.py 2020.9.3"><Image ID="Image:0" Name="Image0"><Pixels ID="Pixels:0" DimensionOrder="XYCZT" Type="uint8" SizeX="88064" SizeY="166912" SizeC="3" SizeZ="1" SizeT="1" Interleaved="true" PhysicalSizeX="0.287" PhysicalSizeXUnit="µm" PhysicalSizeY="0.287" PhysicalSizeYUnit="µm"><Channel ID="Channel:0:0" SamplesPerPixel="3"><LightPath/></Channel><TiffData IFD="0" PlaneCount="1"/></Pixels></Image><Image ID="Image:1" Name="label"><Pixels ID="Pixels:1" DimensionOrder="XYCZT" Type="uint8" SizeX="622" SizeY="518" SizeC="3" SizeZ="1" SizeT="1" Interleaved="true"><Channel ID="Channel:1:0" SamplesPerPixel="3"><LightPath/></Channel><TiffData IFD="1" PlaneCount="1"/></Pixels></Image><Image ID="Image:2" Name="macro"><Pixels ID="Pixels:2" DimensionOrder="XYCZT" Type="uint8" SizeX="311" SizeY="643" SizeC="3" SizeZ="1" SizeT="1" Interleaved="true"><Channel ID="Channel:2:0" SamplesPerPixel="3"><LightPath/></Channel><TiffData IFD="2" PlaneCount="1"/></Pixels></Image></OME>
Samples Per Pixel               : 3
X Resolution                    : 0.287
Y Resolution                    : 0.287
Planar Configuration            : Chunky
Resolution Unit                 : cm
Software                        : tifffile.py
Tile Width                      : 256
Tile Length                     : 256
Tile Offsets                    : (Binary data 2367191 bytes, use -b option to extract)
Tile Byte Counts                : (Binary data 1215029 bytes, use -b option to extract)
Subfile Type                    : Reduced-resolution image
Image Width                     : 44032
Image Height                    : 83456
Bits Per Sample                 : 8 8 8
Compression                     : JPEG
Photometric Interpretation      : YCbCr
Samples Per Pixel               : 3
X Resolution                    : 0.574
Y Resolution                    : 0.574
Planar Configuration            : Chunky
Resolution Unit                 : cm
Software                        : tifffile.py
Tile Width                      : 256
Tile Length                     : 256
Tile Offsets                    : (Binary data 616791 bytes, use -b option to extract)
Tile Byte Counts                : (Binary data 303518 bytes, use -b option to extract)
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Reference Black White           : 0 255 128 255 128 255
Subfile Type                    : Reduced-resolution image
Image Width                     : 22016
Image Height                    : 41728
Bits Per Sample                 : 8 8 8
Compression                     : JPEG
Photometric Interpretation      : YCbCr
Samples Per Pixel               : 3
X Resolution                    : 1.148
Y Resolution                    : 1.148
Planar Configuration            : Chunky
Resolution Unit                 : cm
Software                        : tifffile.py
Tile Width                      : 256
Tile Length                     : 256
Tile Offsets                    : (Binary data 154197 bytes, use -b option to extract)
Tile Byte Counts                : (Binary data 75677 bytes, use -b option to extract)
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Reference Black White           : 0 255 128 255 128 255
Subfile Type                    : Reduced-resolution image
Image Width                     : 11008
Image Height                    : 20864
Bits Per Sample                 : 8 8 8
Compression                     : JPEG
Photometric Interpretation      : YCbCr
Samples Per Pixel               : 3
X Resolution                    : 2.296
Y Resolution                    : 2.296
Planar Configuration            : Chunky
Resolution Unit                 : cm
Software                        : tifffile.py
Tile Width                      : 256
Tile Length                     : 256
Tile Offsets                    : (Binary data 38785 bytes, use -b option to extract)
Tile Byte Counts                : (Binary data 19119 bytes, use -b option to extract)
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Reference Black White           : 0 255 128 255 128 255
Subfile Type                    : Reduced-resolution image
Image Width                     : 5504
Image Height                    : 10432
Bits Per Sample                 : 8 8 8
Compression                     : JPEG
Photometric Interpretation      : YCbCr
Samples Per Pixel               : 3
X Resolution                    : 4.592
Y Resolution                    : 4.592
Planar Configuration            : Chunky
Resolution Unit                 : cm
Software                        : tifffile.py
Tile Width                      : 256
Tile Length                     : 256
Tile Offsets                    : (Binary data 9921 bytes, use -b option to extract)
Tile Byte Counts                : (Binary data 4932 bytes, use -b option to extract)
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Reference Black White           : 0 255 128 255 128 255
Subfile Type                    : Reduced-resolution image
Image Width                     : 2752
Image Height                    : 5216
Bits Per Sample                 : 8 8 8
Compression                     : JPEG
Photometric Interpretation      : YCbCr
Samples Per Pixel               : 3
X Resolution                    : 9.184
Y Resolution                    : 9.184
Planar Configuration            : Chunky
Resolution Unit                 : cm
Software                        : tifffile.py
Tile Width                      : 256
Tile Length                     : 256
Tile Offsets                    : (Binary data 2540 bytes, use -b option to extract)
Tile Byte Counts                : (Binary data 1270 bytes, use -b option to extract)
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Reference Black White           : 0 255 128 255 128 255
Subfile Type                    : Reduced-resolution image
Image Width                     : 1376
Image Height                    : 2608
Bits Per Sample                 : 8 8 8
Compression                     : JPEG
Photometric Interpretation      : YCbCr
Samples Per Pixel               : 3
X Resolution                    : 18.368
Y Resolution                    : 18.368
Planar Configuration            : Chunky
Resolution Unit                 : cm
Software                        : tifffile.py
Tile Width                      : 256
Tile Length                     : 256
Tile Offsets                    : (Binary data 725 bytes, use -b option to extract)
Tile Byte Counts                : (Binary data 365 bytes, use -b option to extract)
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Reference Black White           : 0 255 128 255 128 255
Subfile Type                    : Reduced-resolution image
Image Width                     : 688
Image Height                    : 1304
Bits Per Sample                 : 8 8 8
Compression                     : JPEG
Photometric Interpretation      : YCbCr
Samples Per Pixel               : 3
X Resolution                    : 36.736
Y Resolution                    : 36.736
Planar Configuration            : Chunky
Resolution Unit                 : cm
Software                        : tifffile.py
Tile Width                      : 256
Tile Length                     : 256
Tile Offsets                    : (Binary data 197 bytes, use -b option to extract)
Tile Byte Counts                : (Binary data 102 bytes, use -b option to extract)
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Reference Black White           : 0 255 128 255 128 255
Subfile Type                    : Reduced-resolution image
Image Width                     : 344
Image Height                    : 652
Bits Per Sample                 : 8 8 8
Compression                     : JPEG
Photometric Interpretation      : YCbCr
Samples Per Pixel               : 3
X Resolution                    : 73.472
Y Resolution                    : 73.472
Planar Configuration            : Chunky
Resolution Unit                 : cm
Software                        : tifffile.py
Tile Width                      : 256
Tile Length                     : 256
Tile Offsets                    : (Binary data 65 bytes, use -b option to extract)
Tile Byte Counts                : 23670 7653 24755 6546 11527 4382
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Reference Black White           : 0 255 128 255 128 255
Subfile Type                    : Reduced-resolution image
Image Width                     : 172
Image Height                    : 326
Bits Per Sample                 : 8 8 8
Compression                     : JPEG
Photometric Interpretation      : YCbCr
Samples Per Pixel               : 3
X Resolution                    : 146.944
Y Resolution                    : 146.944
Planar Configuration            : Chunky
Resolution Unit                 : cm
Software                        : tifffile.py
Tile Width                      : 256
Tile Length                     : 256
Tile Offsets                    : 4312022720 4312041142
Tile Byte Counts                : 18422 5793
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Reference Black White           : 0 255 128 255 128 255
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Reference Black White           : 0 255 128 255 128 255
Image Width                     : 622
Image Height                    : 518
Bits Per Sample                 : 8 8 8
Compression                     : Uncompressed
Photometric Interpretation      : RGB
Strip Offsets                   : 4312047248
Samples Per Pixel               : 3
Rows Per Strip                  : 518
Strip Byte Counts               : 966588
X Resolution                    : 1
Y Resolution                    : 1
Planar Configuration            : Chunky
Resolution Unit                 : None
Software                        : tifffile.py
Image Width                     : 311
Image Height                    : 643
Bits Per Sample                 : 8 8 8
Compression                     : Uncompressed
Photometric Interpretation      : RGB
Strip Offsets                   : 4313014144
Samples Per Pixel               : 3
Rows Per Strip                  : 643
Strip Byte Counts               : 599919
X Resolution                    : 1
Y Resolution                    : 1
Planar Configuration            : Chunky
Resolution Unit                 : None
Software                        : tifffile.py

@suresh.sivanantham , the extracted TIFF metadata seems to be valid. You can check the position of the input stream after loading error, since it may point closer to the cause. The best option is sample sharing of course.
Hope this helps!