Is it possible to create 24-bit gif in Matlab?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Michal Dudek
am 3 Nov. 2015
Kommentiert: Michal Dudek
am 10 Nov. 2015
I would like to create 24-bit animated gif from figure. Is it even possible in Matlab?
Below part of my code:
current_frame = getframe(fig3D);
[frame_indices, cmap] = rgb2ind(current_frame.cdata,256,'nodither');
movie_frames = repmat(frame_indices,[1 1 1 movFrames]);
for ii = 1:movFrames
[...]
ff = getframe(fig3D);
[movie_frames(:,:,1,ii),cmap] = rgb2ind(ff.cdata,cmap,'nodither');
end
imwrite(movie_frames,cmap,[movFilePath,'\',movFileName],'DelayTime',0,'LoopCount',inf);
0 Kommentare
Akzeptierte Antwort
Jan
am 10 Nov. 2015
24 bit GIFs are implemented as a multi-frame GIF without a time delay between the parts. For each frame of a picture a 8 bit color map can be created, if it is small enough. So the program must split the image into appropriate parts and save them as frames of an animated GIF and set the delay to zero. See https://en.wikipedia.org/wiki/GIF#True_color
Many browsers and e.g. Photoshop can read an display such 24-bit GIFs, but the definition is at least awkward. I do not know a method to create such GIFs in Matlab, and I would hesitate to create one, because PNGs are smarter.
0 Kommentare
Weitere Antworten (1)
Image Analyst
am 3 Nov. 2015
6 Kommentare
Image Analyst
am 10 Nov. 2015
I didn't know either but after reading Guillaume's answer I thought I'd check PNG since it's pretty much become/becoming the new defacto standard, and sure enough, there's an animated PNG: https://en.wikipedia.org/wiki/APNG
The Animated Portable Network Graphics (APNG) file format is an extension to the Portable Network Graphics (PNG) specification. It allows for animated PNG files that work similarly to animated GIF files, while supporting 24-bit images and 8-bit transparency not available for GIFs. It also retains backward compatibility with non-animated PNG files.
The first frame of an APNG file is stored as a normal PNG stream, so most standard PNG decoders are able to display the first frame of an APNG file. The frame speed data and extra animation frames are stored in extra chunks (as provided for by the original PNG specification).
APNG competes with Multiple-image Network Graphics (MNG), a comprehensive format for bitmapped animations created by the same team as PNG. APNG's advantage is the smaller library size and compatibility with older PNG implementations.
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!