How can I load a tif file and save it again with the same parameters as before?
8 views (last 30 days)
Show older comments
I want to load a tif file and save it again, but the saved file is not the same like the original file. helgoland_bathy.tif is a bathymetry map with georeferenced coordinates. The problem is that the second file has the wrong entries in the info parameter. Like PixelScale, RefMatrix and so on. It is possble to get all ifnormation from the tif file and save this again as a new tif with the identical information?
infilename = 'helgoland_bathy.tif';
[A,R] = readgeoraster(infilename);
info = geotiffinfo(infilename);
geoTags = info.GeoTIFFTags.GeoKeyDirectoryTag;
geotiffwrite('helgoland_bahty_2.tif',A,R,'GeoKeyDirectoryTag',geoTags)
0 Comments
Answers (1)
arushi
on 22 Aug 2024 at 4:01
Hi Jonas Müller
The problem lies in the size of the image. MATLAB has a limitation where it can only save images in the traditional “TIFF” format that are up to 2^32-1 bytes in size, due to its 32-bit restriction. While MATLAB's version of ‘libtiff’ can handle and read 64-bit TIFF images, it cannot write them.
For further details and additional information, you can consult the following blog: http://blogs.mathworks.com/steve/2013/08/07/tiff-bigtiff-and-blockproc/
Hope this helps.
See Also
Categories
Find more on Image Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!