Turning a sequence of images into a gif directly
5 views (last 30 days)
Show older comments
The process whereby one converts a figure to an image to a GIF is well-documented, but what if I instead have a sequence of images (actually, just a sequence of square arrays I would like to graphically represent in some way) and I want to turn them into a gif?
This is the process which I guessed would give me some success, and indeed the program doesn't spit out any errors. It also, as far as I'm aware, doesn't spit out any output (I've searched my computer for testAnimated.gif and it appears to not exist).
filename = 'testAnimated.gif';
for idx = 1:length(t)
Smap= [AN ARRAY OBTAINED IN SOME WAY]
A=image(Smap*20);
map=colormap(gray);
%[A,map] = rgb2ind(image(X); colormap(map));
if idx == 1
imwrite(A,map,filename,'gif','LoopCount',Inf,'DelayTime',1);
else
imwrite(A,map,filename,'gif','WriteMode','append','DelayTime',1);
end
end
Any help would be appreciated.
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!