PHPackages                             depage/graphics - 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. depage/graphics

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

depage/graphics
===============

depage-graphics is a helper class to get resized and optimized images and thumbnails.

2160[1 issues](https://github.com/depage/depage-graphics/issues)PHP

Since Oct 16Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/depage/depage-graphics)[ Packagist](https://packagist.org/packages/depage/graphics)[ RSS](/packages/depage-graphics/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

depage-graphics
===============

[](#depage-graphics)

depage-graphics is a helper class to get resized and optimized images and thumbnails.

[![Latest Stable Version](https://camo.githubusercontent.com/2e16d76d865294813fd62fc70528060e48de0629e1a8139bbd741ee75fd97330/68747470733a2f2f706f7365722e707567782e6f72672f6465706167652f67726170686963732f762f737461626c652e706e67)](https://packagist.org/packages/depage/graphics) [![Build Status](https://camo.githubusercontent.com/a6091b21b8e85b0a7fc02f8ac6b114734ad06e69677751a72c1c8a6371260a41/68747470733a2f2f7472617669732d63692e6f72672f6465706167652f6465706167652d67726170686963732e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/depage/depage-graphics)

Features
--------

[](#features)

- supports gd as basic image resizing method
- support imagemagick and graphicsmagick binaries for better image quality support
- support external tools to optimize images like
    - jpegtran
    - jpegoptim
    - optipng
    - pngcrush
- composer support

You can compare depage-graphics to [SLIR, Smart Lencioni Image Resizer](https://github.com/lencioni/SLIR). But where SLIR is only gd-based, you can use Imagemagick or Graphicsmagick as conversion tools to achieve better image quality.

Basic Usage as Image Service
----------------------------

[](#basic-usage-as-image-service)

You can use the graphics class as an image service to automatically resize, crop, convert and optimize your images, or to generate thumbnails.

To convert your image you add specific action to your image:

```
/path-to/image.jpg.resize-400x400.jpg
/path-to/image.jpg.r400x400.jpg

/path-to/image.jpg.thumb-100x75.jpg
/path-to/image.jpg.t100x75.jpg

/path-to/image.jpg.crop-200x200-10x10.jpg
/path-to/image.jpg.c200x200-10x10.jpg

```

You can also chain actions and parameters:

```
/path-to/image.png.resize-400x400.quality-50.background-ffffff.jpg
/path-to/image.png.r400x400.q50.bg-ffffff.jpg

```

This would resize your image to 400x400px set the jpeg quality to 50 and add a white background for transparent pixels.

### Basic image service

[](#basic-image-service)

Basic usage as image service with the gd library and no image optimization:

```
