PYTHON IMAGES
Creating BigTiff Files
Generate your own sample files
Purpose: Create sample BigTiff files
Last Update: January 26, 2021
A note from the Author
As I scoped the web for BigTiff images, I was not able to find any. Particularly, I needed +20 GB image to test an compression tool. Of course no one is crazy enough to host images that large and if they do it will be a minute before you can download them. Here is a simple solution to this problem.
Install the Dependencies
I will advise that you create an virtual environment and then run the following pip command:
pip install tifffile
Yup, we are done here.
Generating a 30 GB BigTiff File
To generate a 30GB BigTiff file run the following script.
import numpy
import tifffile as tiffdata = numpy.random.randint(0, 255, (100000, 100000, 3), 'uint8')tiff.imwrite('temp.tif', data, bigtiff=True, photometric='rgb')
I would like to note that I ran this on a M1 Mac Mini with 8GB of RAM. Of course, my M1 Mac Mini can’t handle load 30 GB of data in the RAM so instead it uses the SSD to swap most of the contents of data
variable. The script takes about 5 minutes to execute.
To generate smaller/large BigTiff files, you should change the dimensions of the data
variable. If I recall correctly, a 50000
by 50000
generates an 8GB BigTiff.