Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to split animated GIF into an array of UIImages?

I need to do some processing on the individual frames of an animated GIF so I need to be able to split an animated GIF, do some processing and merge it back again into a GIF.

I know how to create an animated gif from separate UIImages but I don't know how to split the frames of a GIF into separate UIImages.

Could anyone share some code that can do this?

like image 756
Ramin Afshar Avatar asked Feb 28 '14 17:02

Ramin Afshar


People also ask

How do I split a GIF file into multiple frames?

Once the GIF file has been uploaded, click the Split to frames! button and each frame will be displayed at the bottom of the webpage. Above the images, press the “ Download frames as Zip ” button to save all images as static GIFs in an archive. Use the Split Options dropdown menu to save as either PNG or JPG files.

How to convert animated images into individual frames?

This online tool is designed to convert animated images into individual frames (sequence of images) to edit or view them separately. GIF explode tool, splitter, decompiler - call it whatever you want. It's mainly intended for splitting GIFs but can be used for almost any other animated image format as well.

What is an animated GIF frame extractor?

Animated GIF Frame Extractor Animated GIF Frame Extractor is an ultra-lightweight and easy-to-use GIF frame extraction tool that can help you quickly extract a single frame or all frames from an animated GIF image.

How to convert GIF to frames on Mac?

To convert GIF to frames, right-click on the player and select "Extract Frames" option. Then set a range for frames you want to extract using the sliders on a new window, press "Extract Frames" button. Specify a save path and file name, you can extract GIF frames as BMP, JPG, GIF (not animated), PNG, TIFF, EXIF, EMF or WMF images. 5. 7GIF


1 Answers

You can use the Image I/O framework to load the frames of an animated GIF as individual CGImage objects, which you can then wrap in UIImage objects.

However, it would probably be much easier for you to just use my public domain UIImage+animatedGIF category to load the GIF into an animated UIImage, and then access the images property of the animated image to get the individual frames.

like image 60
rob mayoff Avatar answered Sep 30 '22 08:09

rob mayoff