PHPackages                             webit-de/compress-images - 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. [CLI &amp; Console](/categories/cli)
4. /
5. webit-de/compress-images

ActiveProject[CLI &amp; Console](/categories/cli)

webit-de/compress-images
========================

Compress images with TinyPNG

2.0.0(8y ago)31.2k2GPL-2.0+PHPPHP &gt;=7.0.0

Since Feb 15Pushed 5y ago2 watchersCompare

[ Source](https://github.com/webit-de/compress-images)[ Packagist](https://packagist.org/packages/webit-de/compress-images)[ Docs](https://github.com/webit-de/compress-images/)[ RSS](/packages/webit-de-compress-images/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

Compress images with TinyPNG
============================

[](#compress-images-with-tinypng)

Compress all PNG &amp; JPG images within an directory and its subdirectories using the [tinypng.com](https://tinypng.com/) API.

[![Packagist](https://camo.githubusercontent.com/5caa320441d394dd9ba820ad3b21c386b433cddcd199459bddd27104c253497a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f77656269742d64652f636f6d70726573732d696d616765732e737667)](https://packagist.org/packages/webit-de/compress-images/)

Requirements
------------

[](#requirements)

- PHP with CLI &amp; CURL modules
- Composer
- A [tinyPNG API Key](https://tinypng.com/developers)

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

[](#installation)

Packagist Entry

```
composer create-project webit-de/compress-images .

```

Usage
-----

[](#usage)

```
php compress-images.php [input directory] [output directory] [API key]

```

eg:

```
php compress-images.php /tmp/images/ /tmp/images/ L33T-R2D2

```

Motivation
----------

[](#motivation)

This script was made to compress all images recursively in a given directory.

It was meant to be a simple, executable example on how to use the TinyPNG API with PHP.

TinyPNG has a great documentation on how to do more stuff like resizing or using cloud services as target directory:

-

So feel free to use this script as a kickstarter and adapt it to your own needs.

License
-------

[](#license)

GNU General Public License version 2

The GNU General Public License can be found at .

Author
------

[](#author)

Dan Untenzu ( / [@pixelbrackets](https://github.com/pixelbrackets)) for webit! Gesellschaft für neue Medien mbH ()

Changelog
---------

[](#changelog)

Contribution
------------

[](#contribution)

This PHP project is Open Source, so please use, patch, extend or fork it.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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 ~164 days

Total

3

Last Release

3042d ago

Major Versions

1.1.0 → 2.0.02018-01-09

### Community

Maintainers

![](https://www.gravatar.com/avatar/3ca67c6c7d79cf33bb5688dcbf217ad52309a52580b6a490aae8445f446178a3?d=identicon)[pixelbrackets](/maintainers/pixelbrackets)

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

---

Top Contributors

[![pixelbrackets](https://avatars.githubusercontent.com/u/1592995?v=4)](https://github.com/pixelbrackets "pixelbrackets (8 commits)")

---

Tags

cliimage-compressionphptinypngtinypng-api

### Embed Badge

![Health badge](/badges/webit-de-compress-images/health.svg)

```
[![Health](https://phpackages.com/badges/webit-de-compress-images/health.svg)](https://phpackages.com/packages/webit-de-compress-images)
```

###  Alternatives

[wp-cli/wp-cli

WP-CLI framework

5.0k17.2M318](/packages/wp-cli-wp-cli)[consolidation/annotated-command

Initialize Symfony Console commands from annotated command class methods.

22569.8M18](/packages/consolidation-annotated-command)[chi-teck/drupal-code-generator

Drupal code generator

26947.8M5](/packages/chi-teck-drupal-code-generator)[seld/cli-prompt

Allows you to prompt for user input on the command line, and optionally hide the characters they type

24725.8M17](/packages/seld-cli-prompt)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[php-tui/php-tui

Comprehensive TUI library heavily influenced by Ratatui

589747.0k6](/packages/php-tui-php-tui)

PHPackages © 2026

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