Download the PHP package midnight/image without Composer
On this page you can find all versions of the php package midnight/image. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package image
midnight/image
A small image editing library for PHP
Installation
The library is available as a Composer package:
Usage
Open an image:
Apply a filter:
Get the new image after applying a filter:
Included filters
The library comes with some pre-defined filters. They can be accessed by calling the filter name as a method of the image object. All filters accept an options array as their only argument. For example:
fit
Scales the image up or down to fit it inside a rectangle defined by the options width and height. It's the equivalent of CSS's background-size: contain property or Adobe InDesign's "Fit proportionally" option.
fill
The fill filter fills a rectangle defined by the options width and height. It's the equivalent of CSS's background-size: cover property or Adobe InDesign's "Fill proportionally" option. It will most likely crop parts of the image.
brighten
Brightens the image. The only option is amount, which accepts an integer from -255 (which actually darkens the image) to 255.
desaturate
Desaturates the image. The only option is amount, which accepts an integer from -100 (which actually saturates image) to 100.
colorcast
Applies a color cast to the image. The available options are color, which accepts an instance of Midnight\Color\Color (actually ColorInterface) and amount, which accepts a value between 0 and 1.
noise
Adds noise to the image. The only option available is amount.
Adding a custom filter
You can easily add a custom filter:
All versions of image with dependencies
zendframework/zend-servicemanager Version >=2.0.0
midnight/color Version ~1.0