File Exchange

image thumbnail

Tools to read and write animated gif files

version 2.3.1 (8.61 KB) by DGM
Functions to read and write animated gifs to and from 4-D RGB image arrays

4 Downloads

Updated 25 Nov 2020

View Version History

View License

These functions can be used to read and write animated gifs. They are intended for use with 4-D image arrays of various type. Supported types include RGB/RGBA arrays, as well as indexed images. Indexed mages with transparent content can be specified by a corresponding vector of indices, or by simply appending an alpha channel to the image array itself. When writing, colormaps, transparency, and disposal method can be specified per-frame or globally.
.
Optional functionality requires the use of imagemagick and is exclusively intended to work in a *nix environment, but default settings should work on other systems. I have no intention of modifying this to be more robust in that aspect.
.
====================
.
GIFREAD(FILEPATH, {KEYWORDS})
reads all frames of an animated gif into a 4-D image array
.
====================
.
GIFWRITE(INARRAY, {DISPOSALMETHOD}, FILEPATH, {DELAY}, {WRITEMETHOD})
GIFWRITE(INARRAY, MAP, {TRANSPARENTIDX}, {DISPOSALMETHOD}, FILEPATH, {DELAY}, {WRITEMETHOD})
Write image stack to an animated gif
.
These tools are merely a subset of the Matlab Image Manipulation Toolbox (FEX)
https://www.mathworks.com/matlabcentral/fileexchange/53786-image-manipulation-toolbox

Cite As

DGM (2021). Tools to read and write animated gif files (https://www.mathworks.com/matlabcentral/fileexchange/52514-tools-to-read-and-write-animated-gif-files), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (5)

Georgy Kukharev

Thank you for your help!!! - Georgy Kukharev

Andrew Janke

DGM

Jack: That sounds reasonable. I've added that to the todo list.

Jack Egerton

Great gifwrite(). How about having a frame range for gifread() so one can efficiently test methods used on large GIFs, for example?

Esteban Hufstedler

MATLAB Release Compatibility
Created with R2009b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!