https://github.com/xp-framework/imaging
Imaging APIs for the XP Framework
https://github.com/xp-framework/imaging
gd image-processing php7 php8 xp-framework
Last synced: 9 months ago
JSON representation
Imaging APIs for the XP Framework
- Host: GitHub
- URL: https://github.com/xp-framework/imaging
- Owner: xp-framework
- Created: 2013-11-12T10:16:41.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2025-01-01T12:50:10.000Z (about 1 year ago)
- Last Synced: 2025-04-07T06:03:23.931Z (9 months ago)
- Topics: gd, image-processing, php7, php8, xp-framework
- Language: PHP
- Homepage:
- Size: 4.43 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
Awesome Lists containing this project
README
Imaging APIs for the XP Framework
========================================================================
[](https://github.com/xp-framework/imaging/actions)
[](https://github.com/xp-framework/core)
[](https://github.com/xp-framework/core/blob/master/LICENCE.md)
[](http://php.net/)
[](http://php.net/)
[](https://packagist.org/packages/xp-framework/imaging)
Loading an image
----------------
```php
use img\Image;
use img\io\JpegStreamReader;
use io\File;
$image= Image::loadFrom(new JpegStreamReader(new File('image.jpeg')));
// Can now be manipulated
```
Manipulating an image
---------------------
Resizing the original image to 640x480
```php
use img\Image;
$transformed= Image::create(640, 480, Image::TRUECOLOR);
$transformed->resampleFrom($image);
```
Apply filters:
```php
use img\filters\SharpenFilter;
$transformed->apply(new SharpenFilter());
```
Convert:
```php
use img\convert\GrayscaleConverter;
$transformed->convertTo(new GrayscaleConverter());
```
Saving an image
---------------
```php
use img\io\JpegStreamWriter;
use io\File;
$transformed->saveTo(new JpegStreamWriter(new File('transformed.jpeg'), 100));
```