Created
January 27, 2024 04:11
-
-
Save jwt625/4715a5ea82e4c0d7348ad247ba1ff562 to your computer and use it in GitHub Desktop.
convert tif to png in matlab
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Get a list of all TIF files in the current folder | |
tifFiles = dir('*.tif'); | |
% Loop through each TIF file | |
for i = 1:length(tifFiles) | |
% Read the TIF file | |
tifFileName = tifFiles(i).name; | |
tifData = imread(tifFileName); | |
% Convert to PNG | |
pngFileName = strrep(tifFileName, '.tif', '.png'); | |
imwrite(tifData, pngFileName); | |
% Display a message | |
disp(['Converted and saved: ' pngFileName]); | |
end | |
disp('Conversion complete.'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment