PHPackages                             misteram/php-respimg - 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. misteram/php-respimg

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

misteram/php-respimg
====================

A responsive image workflow for optimizing and resizing your images

1.0.1(11y ago)012MITPHPPHP &gt;=5.3.0

Since Apr 7Pushed 8y agoCompare

[ Source](https://github.com/dotsplatform/php-respimg)[ Packagist](https://packagist.org/packages/misteram/php-respimg)[ Docs](https://github.com/nwtn/php-respimg/)[ RSS](/packages/misteram-php-respimg/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (7)Dependencies (1)Versions (6)Used By (0)

php-respimg
===========

[](#php-respimg)

A responsive image workflow for optimizing and resizing your images.

See also [grunt-respimg](https://www.npmjs.com/package/grunt-respimg).

Full documentation available at .

Requirements/dependencies
-------------------------

[](#requirementsdependencies)

- [PHP &gt;= 5.3.0](http://php.net/)
- [ImageMagick](http://imagemagick.org/)
- [ext-imagick](http://php.net/manual/en/book.imagick.php)
- For optimization, depending on what settings you pass:
    - [SVGO](https://github.com/svg/svgo)
    - [image\_optim](https://github.com/toy/image_optim)
    - [picopt](https://github.com/ajslater/picopt)
    - [ImageOptim](https://imageoptim.com/)

Examples
--------

[](#examples)

To resize one raster image, without optimization:

```
$image = new nwtn\Respimg($input_filename);
$image->smartResize($output_width, $output_height, false);
$image->writeImage($output_filename);
```

To resize one raster image and maintain aspect ratio, without optimization:

```
$image = new nwtn\Respimg($input_filename);
$image->smartResize($output_width, 0, false);
$image->writeImage($output_filename);
```

To resize one raster image and maintain aspect ratio, with optimization:

```
$image = new nwtn\Respimg($input_filename);
$image->smartResize($output_width, 0, true);
$image->writeImage($output_filename);
nwtn\Respimg::optimize($output_filename, 0, 1, 1, 1);
```

To resize a directory of raster images and maintain aspect ratio, with optimization:

```
$exts = array('jpeg', 'jpg', 'png');
if ($dir = opendir($input_path)) {
	while (($file = readdir($dir)) !== false) {
		$base = pathinfo($file, PATHINFO_BASENAME);
		$ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
		if (in_array($ext, $exts)) {
			$image = new nwtn\Respimg($input_path . '/' . $file);
			$image->smartResize($width, 0, true);
			$image->writeImage($output_path . '/' . $base . '-w' . $w . '.' . $ext);
		}
	}
}
nwtn\Respimg::optimize($output_path, 0, 1, 1, 1);
```

To resize a directory of raster images and SVGs and maintain aspect ratio, with optimization:

```
$exts = array('jpeg', 'jpg', 'png');
if ($dir = opendir($input_path)) {
	while (($file = readdir($dir)) !== false) {
		$base = pathinfo($file, PATHINFO_BASENAME);
		$ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
		if (in_array($ext, $exts)) {
			$image = new nwtn\Respimg($input_path . '/' . $file);
			$image->smartResize($width, 0, true);
			$image->writeImage($output_path . '/' . $base . '-w' . $w . '.' . $ext);
		} elseif ($ext === 'svg') {
			copy($input_path . '/' . $file, $output_path . '/' . $file);
			nwtn\Respimg::rasterize($input_path . '/' . $file, $output_path . '/', $width, 0);
		}
	}
}
nwtn\Respimg::optimize($output_path, 3, 1, 1, 1);
```

Release History
---------------

[](#release-history)

### 1.0.6

[](#106)

- Remove phantom.js
- Updated composer

### 1.0.1

[](#101)

- Library loading bug fix
- Namespacing in README

### 1.0.0

[](#100)

- Major refactoring
- Image optimization
- SVG rasterization
- Basic (non-unit) tests

### 0.0.2

[](#002)

- Fix a path in the test file
- Minor colorspace change (should have no effect on output)
- Comments and stuff

### 0.0.1

[](#001)

- Packagist release

### 0.0.0

[](#000)

- Super experimental pre-release. Feel free to mess about with it, but don’t expect much.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Total

5

Last Release

4086d ago

Major Versions

0.0.2 → 1.0.02015-04-18

### Community

Maintainers

![](https://www.gravatar.com/avatar/1d9e72f4aaec1eb6f15b12504604863656c73ba4d536d2d090e414d8ce563923?d=identicon)[dotsplatfolrm](/maintainers/dotsplatfolrm)

---

Top Contributors

[![nwtn](https://avatars.githubusercontent.com/u/786799?v=4)](https://github.com/nwtn "nwtn (11 commits)")[![dotsplatform](https://avatars.githubusercontent.com/u/32359445?v=4)](https://github.com/dotsplatform "dotsplatform (7 commits)")[![maxbin123](https://avatars.githubusercontent.com/u/3955924?v=4)](https://github.com/maxbin123 "maxbin123 (7 commits)")

---

Tags

ImageMagickimagickresizerwdResponsive Imagesrespimgresponsive web design

### Embed Badge

![Health badge](/badges/misteram-php-respimg/health.svg)

```
[![Health](https://phpackages.com/badges/misteram-php-respimg/health.svg)](https://phpackages.com/packages/misteram-php-respimg)
```

###  Alternatives

[intervention/image

PHP Image Processing

14.3k203.8M2.5k](/packages/intervention-image)[league/glide

Wonderfully easy on-demand image manipulation library with an HTTP based API.

2.6k52.6M138](/packages/league-glide)[intervention/image-laravel

Laravel Integration of Intervention Image

1558.1M160](/packages/intervention-image-laravel)[francodacosta/phmagick

image manipulation with php and ImageMagick

3770.7k1](/packages/francodacosta-phmagick)[orbitale/imagemagick-php

A system that allows creating commands to send to the exec() function to use ImageMagick's powerful features.

42406.9k1](/packages/orbitale-imagemagick-php)[admad/cakephp-glide

CakePHP plugin for using Glide image manipulation library.

34165.3k1](/packages/admad-cakephp-glide)

PHPackages © 2026

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