Skip to content

Instantly share code, notes, and snippets.

@MinhasKamal
Last active December 7, 2015 17:37
Show Gist options
  • Save MinhasKamal/b9d1dcee8d4866c97a0d to your computer and use it in GitHub Desktop.
Save MinhasKamal/b9d1dcee8d4866c97a0d to your computer and use it in GitHub Desktop.
⤵️ A MATLAB program converts image type.
folderName = 'D:\Images\IMAGES_FOR_PROCESSING\lfwcrop_grey\faces';
imagefiles = dir(strcat(folderName, '\*.pgm'));
nfiles = length(imagefiles);
for i=1:nfiles
currentfilename=imagefiles(i).name;
I = imread(strcat(folderName, '\', currentfilename));
[pathstr,name,ext] = fileparts(currentfilename);
currentfilename = name;
imwrite(I, strcat(folderName, '\', currentfilename , '.png'));
fprintf('%d image processed \n', i);
end
fprintf('\n\n## operation successful!!');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment