PHPackages                             maalls/anim-gif - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. maalls/anim-gif

ActiveLibrary[Image &amp; Media](/categories/media)

maalls/anim-gif
===============

PHP class to create an animated GIF from multiple images

v1.4.1(2y ago)021MITPHPPHP &gt;=5.3.0

Since May 13Pushed 2y agoCompare

[ Source](https://github.com/maalls/anim-gif)[ Packagist](https://packagist.org/packages/maalls/anim-gif)[ Docs](https://github.com/maalls/anim-gif)[ RSS](/packages/maalls-anim-gif/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

> *NOTE: This is a fork of [Clément Guillemain](https://github.com/Sybio)'s nice [GifCreator class](https://github.com/Sybio/GifCreator), with some API changes (class rename, new &amp; updated methods, more flexible (and robust) parameter handling etc.), better error handling, several small corrections, code cosmetics &amp; other improvements scattered all across.*

### About

[](#about)

AnimGif is a PHP class to create animated GIFs -- just list the source images (in various forms), and that's it!

### Usage

[](#usage)

**1. Inputs:**

```
// Use an array containing file paths, resource vars (initialized with imagecreatefromXXX),
// image URLs or binary image data.
$frames = array(
    imagecreatefrompng("/../images/pic1.png"),      // resource var
    "/../images/pic2.png",                          // image file path
    file_get_contents("/../images/pic3.jpg"),       // image binary data
    "http://thisisafakedomain.com/images/pic4.jpg", // URL
);

// Or: load images from a dir (sorted, skipping .files):
//$frames = "../images";

// Optionally: set different durations (in 1/100s units) for each frame
$durations = array(20, 30, 10, 10);

// Or: you can leave off repeated values from the end:
//$durations = array(20, 30, 10); // use 10 for the rest
// Or: use 'null' anywhere to re-apply the previous delay:
//$durations = array(250, null, null, 500);
```

**2. Create the GIF:**

```
$anim = new GifCreator\AnimGif();
$anim->create($frames, $durations);

// Or: using the default 100ms even delay:
//$anim->create($frames);

// Or: loop 5 times, then stop:
//$anim->create($frames, $durations, 5); // default: infinite looping
```

**3. Get/use the result:**

You can now get the animated GIF binary:

```
$gif = $anim->get();
```

...and e.g. send it directly to the browser:

```
header("Content-type: image/gif");
echo $gif;
exit;
```

Or just save it to a file:

```
$anim->save("animated.gif");
```

### Behavior

[](#behavior)

- Transparency is based on the first frame. \[!!NOT VERIFIED: "It will be saved only if you give multiple frames with the same transparent background"\]
- The dimensions of the generated GIF are based on the first frame, too. If you need to resize your images to get the same dimensions, you can use this class: .

### Dependencies

[](#dependencies)

- PHP 5.3 (for namespace support &amp; whatnot; noone still shamelessly uses PHP &lt; 5.3, right?!)
- GD (`imagecreatefromstring`, `imagegif`, `imagecolortransparent`)

### Credits

[](#credits)

- László Zsidi: All the tough parts come from his [GIFEncoder.class.php](http://www.phpclasses.org/package/3163) (also found [here, in a Gist](https://gist.github.com/allometry/1438842)). Thanks, Laci!
- Clément Guillemain: for the very handy, redesigned (&amp; "classified") API, extensions and nice docs!
- Matthew Flickinger: for his amazing, unbeatable [GIF format dissection page](http://www.matthewflickinger.com/lab/whatsinagif/bits_and_bytes.asp).

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

1092d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f6b7ae7294bb3add5fe054da21a159aa7670ced6573d9ad80184eede53740772?d=identicon)[maalls](/maintainers/maalls)

---

Top Contributors

[![xparq](https://avatars.githubusercontent.com/u/698307?v=4)](https://github.com/xparq "xparq (120 commits)")[![Sybio](https://avatars.githubusercontent.com/u/1507731?v=4)](https://github.com/Sybio "Sybio (17 commits)")[![maalls](https://avatars.githubusercontent.com/u/1229999?v=4)](https://github.com/maalls "maalls (2 commits)")[![lucanos](https://avatars.githubusercontent.com/u/126774?v=4)](https://github.com/lucanos "lucanos (1 commits)")[![philklc](https://avatars.githubusercontent.com/u/882957?v=4)](https://github.com/philklc "philklc (1 commits)")

---

Tags

phpencodegifanimatedcreation

### Embed Badge

![Health badge](/badges/maalls-anim-gif/health.svg)

```
[![Health](https://phpackages.com/badges/maalls-anim-gif/health.svg)](https://phpackages.com/packages/maalls-anim-gif)
```

###  Alternatives

[lunakid/anim-gif

PHP class to create an animated GIF from multiple images

90136.3k1](/packages/lunakid-anim-gif)[sybio/gif-creator

PHP class that creates animated GIF from multiple images

326395.7k14](/packages/sybio-gif-creator)[sybio/gif-frame-extractor

PHP class that separates all the frames (and their duration) of an animated GIF

179417.2k8](/packages/sybio-gif-frame-extractor)[dereuromark/media-embed

A PHP library to deal with all those media services around, parsing their URLs and embedding their audio/video content in websites.

182530.3k11](/packages/dereuromark-media-embed)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
