PHPackages                             contao/imagine-svg - 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. contao/imagine-svg

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

contao/imagine-svg
==================

Contao Imagine SVG library

1.0.4(1y ago)863.0M↓32.1%9[1 issues](https://github.com/contao/imagine-svg/issues)13LGPL-3.0-or-laterPHPPHP ^7.2 || ^8.0CI passing

Since Jul 29Pushed 3mo ago3 watchersCompare

[ Source](https://github.com/contao/imagine-svg)[ Packagist](https://packagist.org/packages/contao/imagine-svg)[ Fund](https://to.contao.org/donate)[ RSS](/packages/contao-imagine-svg/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (17)Used By (13)

Contao Imagine SVG library
==========================

[](#contao-imagine-svg-library)

[![](https://camo.githubusercontent.com/3a16fba8d7d8d16687706e70018318929a2fa8ee6ce27c66114b765e1becc594/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f636f6e74616f2f696d6167696e652d7376672f63692e796d6c3f6272616e63683d312e78267374796c653d666c61742d737175617265)](https://github.com/contao/imagine-svg/actions?query=branch%3A1.x)[![](https://camo.githubusercontent.com/9d52de0f55f364ea0b86df3a59e5965ddbc4f06b7d2a806d7b28b97677daac2c/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f636f6e74616f2f696d6167696e652d7376672f312e782e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/gh/contao/imagine-svg)[![](https://camo.githubusercontent.com/ad7b8a6622e7e27b51f634eef0b91bb08535c15e60cdaad52bf3d6350d1d4afa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f6e74616f2f696d6167696e652d7376672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/contao/imagine-svg)[![](https://camo.githubusercontent.com/7cf562ee5f819bbcb58645fe5d0835978d58c96d2181607e5f1d03d4eba794ac/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f6e74616f2f696d6167696e652d7376672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/contao/imagine-svg)

This project implements the interfaces of [Imagine](https://github.com/avalanche123/Imagine) and allows you to make simple modifications to SVG images. It is used in [Contao](https://contao.org) to handle on-the-fly resizing of SVG images.

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

[](#installation)

```
php composer.phar require contao/imagine-svg
```

Usage
-----

[](#usage)

```
use Contao\ImagineSvg\Imagine;
use Imagine\Image\Box;
use Imagine\Image\Point;

$imagine = new Imagine();

$imagine
    ->open('/path/to/image.svg')
    ->crop(new Point(50, 50), new Box(100, 100))
    ->resize(new Box(40, 40))
    ->save('/path/to/thumbnail.svg')
;

$image = $imagine->open('/path/to/image.svg');

$image->effects()
    ->gamma(1.5)
    ->negative()
    ->grayscale()
    ->colorize($color)
    ->sharpen()
    ->blur(2)
;

$image->save('/path/to/image.svg');
```

Because of the nature of SVG images, the `getSize()` method differs a little bit from other implementations. You can check the return value like in this example:

```
use Contao\ImagineSvg\Imagine;
use Contao\ImagineSvg\SvgBox;

$imagine = new Imagine();
$size = $imagine->open('/path/to/image.svg')->getSize();

if (SvgBox::TYPE_NONE === $size->getType()) {
    // The image has no defined size
} elseif (SvgBox::TYPE_ASPECT_RATIO === $size->getType()) {
    // The image has a relative size, $size->getWidth() and $size->getHeight()
    // should be treated as an aspect ratio
} else {
    // The image has a defined size like a regular image
    // $size->getType() would return SvgBox::TYPE_ABSOLUTE in this case
}
```

###  Health Score

59

—

FairBetter than 99% of packages

Maintenance60

Regular maintenance activity

Popularity56

Moderate usage in the ecosystem

Community28

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 64.6% 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 ~216 days

Recently: every ~503 days

Total

17

Last Release

115d ago

Major Versions

0.2.3 → 1.0.0-RC12020-05-27

PHP version history (6 changes)0.1.0PHP &gt;=5.5.0

0.1.5PHP ^5.5|^7.0

0.2.0PHP ^5.6|^7.0

0.2.2PHP ^5.6 || ^7.0

1.0.0-RC1PHP ^7.2 || ^8.0

1.x-devPHP ^8.1

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/8c7bdddffcaec444b7891b633f45fe2713d2b04ff21a6362fd748720d0822d58?d=identicon)[ausi](/maintainers/ausi)

---

Top Contributors

[![ausi](https://avatars.githubusercontent.com/u/367169?v=4)](https://github.com/ausi "ausi (95 commits)")[![leofeyer](https://avatars.githubusercontent.com/u/1192057?v=4)](https://github.com/leofeyer "leofeyer (48 commits)")[![alexander-schranz](https://avatars.githubusercontent.com/u/1698337?v=4)](https://github.com/alexander-schranz "alexander-schranz (2 commits)")[![chregu](https://avatars.githubusercontent.com/u/47106?v=4)](https://github.com/chregu "chregu (1 commits)")[![xchs](https://avatars.githubusercontent.com/u/1218766?v=4)](https://github.com/xchs "xchs (1 commits)")

---

Tags

cmscontaoimagephpresizersvg

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/contao-imagine-svg/health.svg)

```
[![Health](https://phpackages.com/badges/contao-imagine-svg/health.svg)](https://phpackages.com/packages/contao-imagine-svg)
```

###  Alternatives

[liip/imagine-bundle

This bundle provides an image manipulation abstraction toolkit for Symfony-based projects.

1.7k38.3M217](/packages/liip-imagine-bundle)[folklore/image

Image manipulation library for Laravel 5 based on Imagine and inspired by Croppa for easy url based manipulation

270248.2k5](/packages/folklore-image)[rokka/imagine-vips

libvips adapter for imagine

43564.1k5](/packages/rokka-imagine-vips)[orchestra/imagine

Imagine (Wrapper) Component for Laravel

70207.0k3](/packages/orchestra-imagine)[media-alchemyst/media-alchemyst

An Object Oriented wrapper for easy multimedia conversion, based on Imagine, FFMpeg, SwfTools, Unoconv and other libs

65216.4k1](/packages/media-alchemyst-media-alchemyst)[contao/image

Contao image library

131.7M9](/packages/contao-image)

PHPackages © 2026

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