多张图片转为gif

for i=1:297
    %disp(i);
    str = strcat(num2str(i), '.png');
    A=imread(str);
    [I,map]=rgb2ind(A,256);
    if(i==1)
        imwrite(I,map,'movefig.gif','DelayTime',0.001,'LoopCount',Inf)
    else
        imwrite(I,map,'movefig.gif','WriteMode','append','DelayTime',0.001)    
    end
end

 

你可能感兴趣的:(matlab)