批量图片格式转化

%将.bmp文件转成压缩文件.JPG
clc;
clear all;
close all;
for i=1:1:163
    filename = strcat(num2str(i),'.bmp');
    I = imread(filename);
    I = I(:,:,1)/3+I(:,:,2)/3+I(:,:,3)/3;
    pathname = strcat('D:\Matlab_Proj\ImageRegstrationByZiheng\CTData\CTLiverData\CTAbdomenData\',num2str(i),'.jpg');
    imwrite(I,pathname,'bmp');
end

你可能感兴趣的:(批量图片格式转化)