PHPackages                             grandt/phpresizegif - 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. grandt/phpresizegif

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

grandt/phpresizegif
===================

GIF89a compliant Gif resizer, including transparency and optimized gifs with sub sized elements.

1.0.3(11y ago)12379.8k↓13.6%4[1 issues](https://github.com/Grandt/PHPResizeGif/issues)7LGPL-2.1PHPPHP &gt;=5.3.0

Since Apr 28Pushed 10y ago2 watchersCompare

[ Source](https://github.com/Grandt/PHPResizeGif)[ Packagist](https://packagist.org/packages/grandt/phpresizegif)[ Docs](https://github.com/Grandt/PHPResizeGif)[ RSS](/packages/grandt-phpresizegif/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (1)Versions (5)Used By (7)

Resize animated Gif files
=========================

[](#resize-animated-gif-files)

This package aims to implement a proper resizing of gif files encompassing the GIF89a specification.

Introduction
------------

[](#introduction)

Most, if not all other publicly available gif resize packages fails with optimized gif files, those where only parts of the file are updated in subsequent frames. See these as a background image, with sprites moving about. The resulting gif will retain its aspect ratio.

The package is a bit pedantic in its approach. It was made as much for me to learn what Gifs were and how they work, as it was to solve specific problem.

Usage
-----

[](#usage)

The package needs to write to a file, the reasons for not just return a string is twofold. One being memory usage, the other is that you really don't want to be dynamically resizing often used gif files every time they are used.

### Import

[](#import)

Add this requirement to your `composer.json` file:

```
    "grandt/phpresizegif": ">=1.0.3"
```

### Composer

[](#composer)

If you already have Composer installed, skip this part.

[Packagist](https://packagist.org/), the main composer repository has a neat and very short guide.

Or you can look at the guide at the [Composer site](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx).

The easiest for first time users, is to have the composer installed in the same directory as your composer.json file, though there are better options.

Run this from the command line:

```
php -r "readfile('https://getcomposer.org/installer');" | php

```

This will check your PHP installation, and download the `composer.phar`, which is the composer binary. This file is not needed on the server though.

Once composer is installed you can create the `composer.json` file to import this package.

```
{
    "require": {
        "grandt/phpresizegif": ">=1.0.3"
    }
}
```

Followed by telling Composer to install the dependencies.

```
php composer.phar install

```

this will download and place all dependencies defined in your `composer.json` file in the `vendor` directory.

Finally, you include the `autoload.php` file in the new `vendor` directory.

```
