MATLAB: How to get a GIF’s ‘DelayTime’

gifimread

I have a GIF file made by MATLAB, and I know how to read the frames or make another GIF file in MATLAB. But I don't know how can I get the delay time information of the file, except to read the scripts by which the GIF was made, or just try different values… So how can I get a *.gif file's 'DelayTime'?
The script to generate the GIF was something like this:
if i==1;
imwrite(Img,cmap,[path_out,filename_out],'gif','Loopcount',inf,'DelayTime',dtime);
else
imwrite(Img,cmap,[path_out,filename_out],'gif','WriteMode','append','DelayTime',dtime);
end

Best Answer

gifinfo = imfinfo('NameOfFile.gif');
DelayTimes = [gifinfo.DelayTime];
This will be a vector with as many entries as there are frames: GIF allows the delay time to be set for each frame.
On the image I tested with, the delay time showed up as 6 for each frame, which is completely unrealistic as it is intended to be a movie.