matlab对图片批量重命名和改大小

clc
clear
StrOut='C:\Users\looloo\Desktop\DCGAN-tensorflow-master\data\new\';%重新保存图片的路径
path = 'C:\Users\looloo\Desktop\DCGAN-tensorflow-master\data\celebA\';%图片原始路径
D = dir([path '*.jpg']);
for i = 1:length(D)
    a = imread([path D(i).name]);
    img = imresize(a,[108,108]);%修改大小
    imwrite(img,[StrOut '\' num2str(i) '.jpg']);%保存
end

你可能感兴趣的:(matlab)