how to convert multiply jpg files to tiff

3 views (last 30 days)
Hey,
I am new to matlab, I tried to convert multiply jpg files to tiff files, with no success.
I know i need to use this lines:
img = imread('FileName.jpg');
imwrite(img, 'FileName.tiff');
But how do I do that with multiply images.
thanks for the help

Accepted Answer

KSSV
KSSV on 22 Feb 2022
jpgFiles = dir('*.jpg') ; % you are in the folder of all jpg files/ you may provde path as well
N = length(jpgFiles) ;
for i = 1:N
% Read
FileName = jpgFiles(i).name ;
img = imread(FileNAme);
% Write
[~,FileName,ext] = fileparts(FileName) ;
OutFile = strcat(FileName,'.tiff') ;
imwrite(img,OutFile);
end

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!