How can I load a tif file and save it again with the same parameters as before?
조회 수: 3 (최근 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일
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에서 Read, Write, and Modify Image에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!