Code covered by the BSD License  

Highlights from
IM2GIF

Be the first to rate this file! 8 Downloads (last 30 days) File Size: 2.91 KB File ID: #32546
image thumbnail

IM2GIF

by Oliver Woodford

 

16 Aug 2011

Converts a multiframe image to an animated GIF.

| Watch this File

File Information
Description

This function converts a multiframe image to an animated GIF.

For example, to create an animation from a series of figures, export to a multiframe TIFF file using export_fig (also available on the FEX), then convert to a GIF, as follows:

    for a = 2 .^ (3:6)
       peaks(a);
       export_fig test.tif -nocrop -append
    end
    im2gif('test.tif', '-delay', 0.5);

MATLAB release MATLAB 7.11 (R2010b)
Tags for This File  
Everyone's Tags
animate, animated, gif, image, multiframe(2)
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
17 Apr 2013 Oliver Woodford

Shaun: As the error suggests, you are trying to concatenate images of different sizes. I don't get this error. Make sure your figure is not changing size between calls to export_fig() for some reason.

17 Apr 2013 Shaun VanWeelden

Oliver, coll idea, but when I run the example I get the following error:

154 A = cat(4, A{:});
Error using cat
Dimensions of matrices being concatenated are not consistent.
Error in im2gif>imread_rgb (line 154)
A = cat(4, A{:});
Error in im2gif>parse_args (line 117)
A = imread_rgb(A);
Error in im2gif (line 44)
[A options] = parse_args(A, varargin{:});

Where in cat(4, A{:}); A is an array of 6-8 images (type uint8), this was in 13a

Contact us