MATLAB: Resizing all images in a folder

folderimageImage Processing Toolbox

I am able to get matlab to resize and save an individual image, but I'm wondering how I can get it to do this for all images in a folder without having to type in the names one by one. The names of the saved & original images must stay the same if that makes any difference. Could I load the images into an array and then have it loop through each image? Sorry if this is a dumb question!

Best Answer

Yep. Try the following function:
dc = dir('*.jpg');
but set the filetype to whatever the images are. Make sure your working directory is the one with the images, obviously. The 'dc' variable will be structure that contains the file information, which will allow you to automate the loading, resizing, and saving of each image.
Related Question