I have a question concerning the maximum size of TIFF files Mathematica can handle. According to the TIFF 6.0 specification -revision 6.0 (see: http://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf) the maximum size of TIFF files is determined by the 32 Bit offsets used by this format. Thus, the theoretical maximum file size of a TIFF file should be about 4 GB.

I am dealing with huge TIFF files that I need to import, process and export with Mathematica. Using Mathematica's Import and Export functions, I cannot import a TIFF file larger than 2 GB nor can I export a TIFF file that exceeds the 2 GB limit.

Consider the following example i created:

data = ConstantArray[Image[ConstantArray[0, {1000, 1000}], "Bit16"], 

Export["test.tif", data];

I create 1500 black images with a bit depth of 16. When i export the data, the export stops at about 2 GB. When I open the file with other software, the file only contains 1073 images.

My first guess was that somehow one Bit is used to determine the sign, but I cannot figure out how to show that. Does anybody have a solution how to import and export TIFF files larger than 2 GB?

Thanks in advance!

System specification

  • OS: Windows 7 Professional, Service Pack 1 (64-bit)
  • Processor: Intel Xeon CPU E5630 @ 2.53 GHz (2 Processors)
  • Installed memory: 96 GB
  • Mathematica 9.0
  • Java version 1.7.0_07


Since I did not find any other solution, I tried reinstalling Mathematica 8 on my computer. Surprisingly, with Mma 8 it was no problem to export and import the testset. I am wondering why this is not possible with the new version.

If you have any ideas, please let me know.

  • $\begingroup$ my 'test.tif' (MacOS X, Mathematica 9) says it's "3,001,404,008 bytes (3 GB on disk)", but I've no software which can open it... $\endgroup$
    – cormullion
    Commented Jan 8, 2013 at 14:58
  • $\begingroup$ I usually open the files with FIJI or ImageJ, respectively. Both are open source. Could this be a OS problem? I am using Windows 7... $\endgroup$
    – g3kk0
    Commented Jan 8, 2013 at 15:07
  • $\begingroup$ For me (Linux 64 bit, Mathematica 9) it's a 2.8GB file and I can read it with ImageJ. $\endgroup$ Commented Jan 8, 2013 at 19:25
  • $\begingroup$ Thanks for your comments. On Windows 7 (64 Bit) I am not able to export the file. Do you know of any options or settings in Mathematica that may cause this behavior? $\endgroup$
    – g3kk0
    Commented Jan 9, 2013 at 7:56
  • $\begingroup$ I can export test.tif (around 2.79G) on 64bit Windows 7 with Mathematica 8. $\endgroup$
    – Tuku
    Commented Jan 9, 2013 at 19:48

2 Answers 2


This is a bug in Mathematica 9, it is already fixed and is just waiting for the next Mathematica release. Unfortunately we learnt about it a bit late and it had to miss the recent 9.0.1 release as well.

  • 2
    $\begingroup$ Thanks for posting this here Shadi! It's good to know that this will be working again in the next release. $\endgroup$
    – Szabolcs
    Commented Feb 22, 2013 at 21:34
  • $\begingroup$ I must have overlooked this informative answer. Thanks Shadi for providing us this information. Hope version 10 is out soon ... ;) $\endgroup$
    – g3kk0
    Commented Jul 27, 2013 at 11:12

I am not sure this will help with TIFF import but it solved my Excel import problem. Also the answer applies to 32-bit Windows, but maybe also to 64-bit. They said there were working to solve the problem. I had a similar problem constructing large TreePlots. Excerpt from WRI Tech support:

We have seen this on 32 bit windows. The issue is that the default size of the java code used by the import is insufficient to load the entire file.

You may be able to import this by raising the java heap size from 256MB to some larger value:

ReinstallJava[JVMArguments -> "-Xmx2000m"]

where "-Xmx2000m" indicates how much RAM to allocate, in this case 2000MB or 2GB.

Unfortunately with a 32 bit systems you do have a limited amount of RAM that is allocatable (typically 2GB). This will limit the size of the XLSX files you can handle. There is unfortunately nothing we can do.

  • $\begingroup$ Thank you for your answer. I tried reinstalling the java link with different settings for the default amount of memory Java can allocate. I also tried to set it up to 4000 MB. After each reinstall, I restarted Mathematica. Unfortunately, this did not solve my problem. I also verified that the file size is limited by 2GB by testing different numbers of images. The export does not export more than 2GB and no error message is generated. $\endgroup$
    – g3kk0
    Commented Jan 10, 2013 at 8:48
  • 3
    $\begingroup$ This is sometimes helpful for Java based converters, (XLS, JPEG2000, etc), but won't help TIFF. $\endgroup$ Commented Jan 17, 2013 at 2:40
  • $\begingroup$ @AlexanderSchmitz I strongly believe that you should NOT restart Mathematica after using ReinstallJava. Contrary to what its name may imply ReinstallJava works for the current session only and does not persist any custom options across Mathematica sessions. This is what I remember from the time I used NETLink to integrate .NET/WCF network services seamlessly: equivalent Uninstall/Install/Reinstall functions in NETLink work for the current session only; I had two separate Mathematica processes on the same machine and I could keep reinstalling NETLink in one without affecting the other ... $\endgroup$
    – Cetin Sert
    Commented Feb 20, 2013 at 5:52
  • $\begingroup$ @AlexanderSchmitz ... or any options passed to .*[Ii]nstall.* functions being persisted across Mathematica sessions / restarts. See InstallJava: launches the Java runtime and prepares it to be used from Mathematica. $\endgroup$
    – Cetin Sert
    Commented Feb 20, 2013 at 5:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.