Powered by Blogger.

Showing posts with label resize multiple images. Show all posts

Resizing multiple images using MATLAB




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.


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