Converting GIF image to movie, the color in the video of images is changing....could see only in gray scale....

10 views (last 30 days)
if true
% code
end
fullFileName = 'C:\Users\Documents\MATLAB\3_3.gif';
v = VideoWriter('newfile.avi','Uncompressed AVI');
open(v)
[gifImage map] = imread(fullFileName,'Frames', 'all');
writeVideo(v,gifImage)
close(v)

Accepted Answer

Walter Roberson
Walter Roberson on 7 Oct 2018
Loop using im2frame https://www.mathworks.com/help/matlab/ref/im2frame.html
writeVideo can accept a numeric array of rgb images, and it can accept a strut array of frames that can be pseudocolor, but it cannot accept a numeric array of pseudocolor images even if they have the same colormap.
There are also ways to batch convert a numeric array of pseudocolor to a numeric rgb array if the same colormap is used for all of them, but I do not know of any built in or file exchange contribution that does that.
  1 Comment
Adam Danz
Adam Danz on 26 May 2020
I've written a function based on this method described by Walter. Walter is attributed within the documentation of the function.
Download gif2avi() from the file exchange.

Sign in to comment.

More Answers (0)

Categories

Find more on Convert Image Type in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!