PHPackages                             masum-packagist/php-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. masum-packagist/php-image-optimizer

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

masum-packagist/php-image-optimizer
===================================

A PHP package for image resizing and compression.

10PHP

Since Oct 22Pushed 1y ago1 watchersCompare

[ Source](https://github.com/masumsoftdev/php-image-optimizer)[ Packagist](https://packagist.org/packages/masum-packagist/php-image-optimizer)[ RSS](/packages/masum-packagist-php-image-optimizer/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

PHP Image Optimizer
===================

[](#php-image-optimizer)

A simple PHP package for resizing and compressing images. Supports JPEG, PNG, and GIF.

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

[](#installation)

Install the package via Composer:

```
composer require masum-packagist/php-image-optimizer
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

You can optimize and resize an image with just a few lines of code:

```
use MasumPackagist\ImageOptimizer\Optimizer;

// Instantiate the optimizer with a quality setting (1-100, where 100 is best quality)
$optimizer = new Optimizer(85);

// Optimize an image by resizing to a max width of 800px and compressing it
$optimizer->optimize('/path/to/source.jpg', '/path/to/optimized.jpg', 800);
```

### Parameters

[](#parameters)

- **Source**: Path to the original image file.
- **Destination**: Path where the optimized image will be saved.
- **New Width** (optional): Resize the image to this width, keeping the aspect ratio intact.

### Image Format Support

[](#image-format-support)

- **JPEG**: Compressed with the provided quality value.
- **PNG**: Compressed with a reversed quality scale (0-9).
- **GIF**: Compression is minimal due to format limitations.

Versioning
----------

[](#versioning)

This package follows [Semantic Versioning](https://semver.org/). The current version is **v1.0.0**.

Features
--------

[](#features)

- **Resize images**: Automatically resize while maintaining aspect ratio.
- **Compress images**: Lossy compression for JPEG and PNG formats.
- **Supported formats**: JPEG, PNG, GIF.

Changelog
---------

[](#changelog)

### v1.0.0

[](#v100)

- Initial release with support for:
    - Image resizing.
    - Compression for JPEG, PNG, and GIF formats.

Contributing
------------

[](#contributing)

If you want to contribute to this project:

1. Fork the repository.
2. Create your feature branch (`git checkout -b feature/your-feature`).
3. Commit your changes (`git commit -m 'Add new feature'`).
4. Push to the branch (`git push origin feature/your-feature`).
5. Create a pull request.

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE](https://opensource.org/licenses/MIT) file for details.

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity17

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/3506455baa296c1b9f8c606052b19ef320cc3988b510cc63935b816e452aba32?d=identicon)[MasumPackagist](/maintainers/MasumPackagist)

---

Top Contributors

[![masumsoftdev](https://avatars.githubusercontent.com/u/139852978?v=4)](https://github.com/masumsoftdev "masumsoftdev (2 commits)")

### Embed Badge

![Health badge](/badges/masum-packagist-php-image-optimizer/health.svg)

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

###  Alternatives

[milon/barcode

Barcode generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)

1.5k13.3M39](/packages/milon-barcode)[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k23](/packages/bkwld-croppa)[goat1000/svggraph

Generates SVG graphs

132849.6k3](/packages/goat1000-svggraph)[cohensive/embed

Media Embed (for Laravel or as a standalone).

120370.4k](/packages/cohensive-embed)[netresearch/rte-ckeditor-image

Image support in CKEditor for the TYPO3 ecosystem - by Netresearch

63991.3k4](/packages/netresearch-rte-ckeditor-image)[humanmade/tachyon-plugin

Rewrites WordPress image URLs to use Tachyon

87338.5k2](/packages/humanmade-tachyon-plugin)

PHPackages © 2026

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