Posted by : Mukunthan GJ Saturday, 23 March 2013




Get all the image files that are need to be re sized in matlab current directory and run this code


dirData = dir('*.jpg'); 
fileNames = {dirData.name};     
for iFile = 1:numel(fileNames)  
newName = sprintf('%1d.jpg',iFile); 
movefile(fileNames{iFile},newName);        
end  


After renaming the files (by running above program ) run this code

q=1;
p=1;
for i=1:10
oq=imread(strcat(num2str(q),'.jpg'));
odprz=imresize(oq,[150 150]);  %# specify your size here
imwrite(odprz,strcat(num2str(p),'.png'));
q=q+1;
p=p+1;
end 


collect only .png format files.That files are re-sized  files.


{ 3 comments... read them below or Comment }

- Copyright © Get Codes - Powered by Blogger - Designed by Mukunthan GJ -