PHPackages                             geckon01/simple-image-compressor - 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. geckon01/simple-image-compressor

ActiveLibrary

geckon01/simple-image-compressor
================================

SimpleImageCompressor is a tiny simple PHP image compressor lib which allows you to compress any image easily on the fly

0.4.3.25(2y ago)0641MITPHPPHP &gt;=7.4

Since Mar 29Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/Geckon01/simple-image-compressor)[ Packagist](https://packagist.org/packages/geckon01/simple-image-compressor)[ Docs](https://github.com/Geckon01/simple-image-compressor)[ RSS](/packages/geckon01-simple-image-compressor/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)DependenciesVersions (4)Used By (0)

SimpleImageCompressor
=====================

[](#simpleimagecompressor)

[![Version](https://camo.githubusercontent.com/2fb08eb796fdd9af6f8984d6e96a3e6872da8d9af7464229633f378f0d4381bb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6765636b6f6e30312f73696d706c652d696d6167652d636f6d70726573736f72)](https://camo.githubusercontent.com/2fb08eb796fdd9af6f8984d6e96a3e6872da8d9af7464229633f378f0d4381bb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6765636b6f6e30312f73696d706c652d696d6167652d636f6d70726573736f72)[![Lecense](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)[![Downloads](https://camo.githubusercontent.com/0d01e6fb7be31115bdf3873257651e0a74a5554f359db4360b1430028330e623/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6765636b6f6e30312f73696d706c652d696d6167652d636f6d70726573736f72)](https://camo.githubusercontent.com/0d01e6fb7be31115bdf3873257651e0a74a5554f359db4360b1430028330e623/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6765636b6f6e30312f73696d706c652d696d6167652d636f6d70726573736f72)[![Codacy Badge](https://camo.githubusercontent.com/17d2fba81d3c84cf0432a7ebd1342d47fa56ed38e6d289a9d7d5edbf32dd6545/68747470733a2f2f6170702e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f6437373333333561363537643436376661616130656262313262633261626531)](https://app.codacy.com/gh/Geckon01/simple-image-compressor/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)

**SimpleImageCompressor** - is a tiny simple PHP image resizer lib which allows you to resize and compress any image easily on the fly.

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

[](#installation)

### With composer

[](#with-composer)

```
composer require "geckon01/simple-image-compressor"
```

### Without composer

[](#without-composer)

1. Download latest release [here](https://github.com/Geckon01/simple-image-compressor/releases).
2. Unpack the archive to your project directory.
3. Include the library files:

```
require "src/SimpleImageCompressor.php";
require "src/CompressedImage.php";
use geckon01\SimpleImageCompressor\SimpleImageCompressor;
```

Usage
-----

[](#usage)

Resize and compress an image:

```
$resolutionTargetPercent = 50;
$targetQuality = 50;
$compressor = SimpleImageCompressor::load("image.png");
$compressedImage = $compressor->resizeAndCompress($resolutionTargetPercent, $targetQuality);
$compressedImage->toFile("image");
```

load method supports loading from local file, or you can specify any valid URL image link like this:

```
$compressor = SimpleImageCompressor::load("https://example.com/image.jpg");
```

Method chaining is supported:

```
SimpleImageCompressor::load("image.png")
	->resizeAndCompress(50, 50)
	->toFile("image");
```

> Note: File extensions are automatically added. Use toFile("filename") without extension.

### Output format

[](#output-format)

You can specify output format. Supported output fomats are:

```
$compressedImage->toFile("image");
```

```
$compressedImage->toBase64();
```

```
$compressedImage->toGdImage();
```

### Size Constraints

[](#size-constraints)

Set approximate minimum dimensions (aspect ratio preserved):

```
$compressor->setApproxMinimumHeight(500);
$compressor->setApproxMinimumWidth(500);
```

> Note actual dimensions may differ due to aspect ratio preservation. Example: 1920×1080 image reduced to 50% becomes 960×540 (maintaining 16:9).

License
-------

[](#license)

This software is licensed under the MIT License. [View the license](LICENSE.md).

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance40

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity37

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.

###  Release Activity

Cadence

Every ~181 days

Total

3

Last Release

776d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0632f1b0193081d94121f6d8f872453bfd4c6b705d1362a413707fa12f25fe48?d=identicon)[geckon01](/maintainers/geckon01)

---

Top Contributors

[![Geckon01](https://avatars.githubusercontent.com/u/19799402?v=4)](https://github.com/Geckon01 "Geckon01 (10 commits)")

---

Tags

composer-libraryimage-resizephpphp-image-resizerphp-libraryphpcompressgifimagespngjpeg

### Embed Badge

![Health badge](/badges/geckon01-simple-image-compressor/health.svg)

```
[![Health](https://phpackages.com/badges/geckon01-simple-image-compressor/health.svg)](https://phpackages.com/packages/geckon01-simple-image-compressor)
```

###  Alternatives

[tihiy-production/php-image-compressor

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

243.8k](/packages/tihiy-production-php-image-compressor)[choowx/rasterize-svg

A PHP library for converting SVG to JPEG, PNG, and WEBP

2261.7k](/packages/choowx-rasterize-svg)[christianbarkowsky/contao-tiny-compress-images

This plugin automatically optimizes your images (JPG, PNG, WebP) by integrating with the popular image compression services TinyJPG and TinyPNG.

2719.0k](/packages/christianbarkowsky-contao-tiny-compress-images)

PHPackages © 2026

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