This topic has been permanently closed and transferred to MATLAB Answers.


david hill
9 views (last 30 days)

Why are tif files so large when using geotiffwrite?

david hill on 8 Nov 2023
Latest activity Reply by Walter Roberson on 8 Nov 2023

I use readgeoraster to read in a 25MB geotiff. I then turn around and immediately write out the data with geotiffwrite. The resultant file is now 250MB.
What is the explanation for this 10x increase in file size? The data read in are 'single' format. And that is the exact data I am writing out.
david hill
david hill on 8 Nov 2023
Interesting. That made the output files 65MB. It came with this warning:
Warning: TIFF library warning - 'TIFFWriteDirectorySec: Creating TIFF with legacy
Deflate codec identifier, COMPRESSION_ADOBE_DEFLATE is more widely supported.'
> In Tiff/close (line 709)
In map.geotiff.internal.writeGeoTiffFile>@()close(tiffObj) (line 51)
In onCleanup/delete (line 25)
In map.geotiff.internal.writeGeoTiffFile>writeImage (line 68)
In map.geotiff.internal.writeGeoTiffFile (line 36)
In geotiffwrite (line 28)
In computeEref (line 105)
Walter Roberson
Walter Roberson on 8 Nov 2023
The compression types permitted by the code are permittedValues = {'LZW', 'PackBits', 'Deflate', 'None'};
It looks like libTiff supports a lot more than that, but geotiffwrite() puts on those restrictions.
You could experiment with LZW.
david hill
david hill on 8 Nov 2023
Thank you, I will try that...I already tried it, but clearly I was not using the syntax correctly.
Walter Roberson
Walter Roberson on 8 Nov 2023
Have you tried using a TiffTags parameter to set Compression to Deflate ?

See Also