PHPackages                             gtuk/image-optimizer - 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. gtuk/image-optimizer

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

gtuk/image-optimizer
====================

PHP image optimizer for png, jpeg and gif files. It uses mozjpeg, pngquant and gifsicle for the optimization process

1.0(10y ago)161.6k1[1 issues](https://github.com/gtuk/ImageOptimizer/issues)MITPHPPHP &gt;=5.4CI failing

Since Jul 24Pushed 10y ago2 watchersCompare

[ Source](https://github.com/gtuk/ImageOptimizer)[ Packagist](https://packagist.org/packages/gtuk/image-optimizer)[ RSS](/packages/gtuk-image-optimizer/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

ImageOptimizer
==============

[](#imageoptimizer)

PHP image optimizer for png, jpeg and gif files. It uses mozjpeg, pngquant and gifsicle for the optimization process.

**This guide assumes you have mozjpeg, pngquant and gifsicle installed.**

Installation
------------

[](#installation)

You can install this library with composer or include it manually in your project.

Quick start
-----------

[](#quick-start)

```
 $optimizer = new Optimizer(
    array(
        Optimizer::PNGQUANT_PATH => '/usr/local/bin/pngquant',
        Optimizer::MOZJPEG_PATH => '/usr/local/bin/cjpeg',
        Optimizer::GIFSICLE_PATH => '/usr/local/bin/gifsicle'
    )
);
```

After this you can run the optimization process. If the optimization failed the method will throw an Exception, otherwise it returns TRUE.

```
$optimizer->optimize('example.jpg', 'example-optimized.jpg'));
```

###  Health Score

30

—

LowBetter than 61% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

3676d ago

### Community

Maintainers

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

---

Tags

phpimagecompressionimage-optimizercompressoptimizationoptimizerpngquantMozJPEGoptimizegifsicle

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gtuk-image-optimizer/health.svg)

```
[![Health](https://phpackages.com/badges/gtuk-image-optimizer/health.svg)](https://phpackages.com/packages/gtuk-image-optimizer)
```

###  Alternatives

[ps/image-optimizer

Image optimization / compression library. This library is able to optimize png, jpg and gif files in very easy and handy way. It uses optipng, pngquant, pngcrush, pngout, gifsicle, jpegoptim and jpegtran tools.

9161.7M25](/packages/ps-image-optimizer)[typisttech/image-optimize-command

Easily optimize images using WP CLI

1742.0k](/packages/typisttech-image-optimize-command)[jkphl/iconizr

A PHP command line tool for converting SVG images to a set of CSS icons (SVG &amp; PNG, single icons and / or CSS sprites) with support for image optimization and Sass output

4849.0k](/packages/jkphl-iconizr)[kinglozzer/tinypng

TinyPNG PHP API

1296.4k2](/packages/kinglozzer-tinypng)[lciolecki/php-image-optimizer

PHP image file optimizer (uses https://github.com/bensquire/php-image-optim)

347.4k](/packages/lciolecki-php-image-optimizer)[tihiy-production/php-image-compressor

ImageCompressor - this is an easy way to compress images on the fly

244.2k](/packages/tihiy-production-php-image-compressor)

PHPackages © 2026

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