How can I load a tif file and save it again with the same parameters as before?
8 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
arushi
2024-8-22,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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!