Hyperstack larger than 4GB


I need to read a hyperstack TIFF larger than 4GB with my own C++ code. Where can I find the specifications of the ImageJ extensions to the standard TIFF format, so that I can understand how ImageJ handles large TIFF files?


Dear @basisunus,

Only in the sources, I fear: you can take a look at the sources of TiffEncoder to get an idea.

In general, I am not sure if ImageJ1 implements the BigTIFF specification.



Thanks, Stefan. By reading the Java code, I was able to speculate how ImageJ saves TIFF files. It seems to me that ImageJ saves the first page at the beginning of the file. So, it’s basically IFD and then the single strip of grayscale values. Then, the strip data of the remaining pages are saved right after the first page. If the total file size is smaller than 4GB, the IFDs of the remaining pages are saved at the end of the file. Otherwise, the pointer to the next page in the first IFD is set to 0. That’s why it says other programs may only read the first page. To conclude, reading Image hyperstack is simple, the format is: header + IFD of the first page + raw data. The additional information needed to decode the raw data is found in the ImageDescription field of the IFD.
Also, BigTiFF is not implemented. BigTIFF uses 64bit addresses in the IFDs, which I think is more reasonable as an extension to the standard TIFF.


If you want a proper BigTIFF, Bio Formats can optionally export in that format. I think it will automatically enable 64 bit support if the data is > 4 GB, or forcefully nudge it by naming the extension .ome.btf.


Thanks for looking into it and reporting back @basisunus! Never really had the nerve to look at the implementation because of @mabruce’s comment.

In addition to that, SCIFIO is also able to write BigTIFFs.