我想用与原始文件相同的延迟时间重写GIF文件。这是示例图片:
这是我的代码,但输出的延迟比原始延迟慢。有没有办法让它等于?
[I map]=imread('a.gif');
delay=0.1;
frame=size(I,4);
loops=65535;
for i = 1:frame
if i==1
imwrite(I(:,:,:,i),map,'b.gif','gif','LoopCount',loops, 'DelayTime', delay); %save file output
else
imwrite(I(:,:,:,i),'b.gif','gif','WriteMode', 'append'); %save file output
end
end
答案 0 :(得分:1)
使用此代码
[I map]=imread('a.gif');
delay=0.03;
frame=size(I,4);
for i = 1:frame
if i==1
imwrite(I(:,:,:,i),map,'b.gif','gif', 'DelayTime', delay,'LoopCount',inf); %save file output
else
imwrite(I(:,:,:,i),'b.gif','gif','WriteMode', 'append', 'DelayTime', delay); %save file output
end
end