필터 지우기
필터 지우기

Is it possible to create 24-bit gif in Matlab?

조회 수: 1 (최근 30일)
Michal Dudek
Michal Dudek 2015년 11월 3일
댓글: Michal Dudek 2015년 11월 10일
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);

채택된 답변

Jan
Jan 2015년 11월 10일
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.

추가 답변 (1개)

Image Analyst
Image Analyst 2015년 11월 3일
  댓글 수: 6
Image Analyst
Image Analyst 2015년 11월 10일
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.
Michal Dudek
Michal Dudek 2015년 11월 10일
Yes, APNG would be the best choice, but as far as I know it is not implemented in Matlab.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by