23 lines
689 B
Matlab
Executable File
23 lines
689 B
Matlab
Executable File
%tif2jpeg converter
|
|
[Scanfiles, pathname]=uigetfile('*', 'Select a Folder File');
|
|
path=pathname;
|
|
dirLst=dir(path);
|
|
for i=1:size(dirLst,1)
|
|
if ~isempty(str2num(dirLst(i).name))
|
|
selDir=fullfile(path,dirLst(i).name);
|
|
filelst=dir(selDir);
|
|
|
|
for n=1:size(filelst,1)
|
|
try
|
|
if ~isempty(strfind(filelst(n).name,'bmp'))
|
|
inFile=filelst(n).name;
|
|
a=imread(fullfile(selDir,inFile)); %(inFile{1});
|
|
outFile= strrep(inFile,'.bmp','.jpg');
|
|
imwrite(a,fullfile(selDir,outFile), 'quality',95)
|
|
end
|
|
catch
|
|
end
|
|
end
|
|
end %if ~isempty(str2num(dirLst(i).name))
|
|
end %for all numeric folders
|