xp-framework / imaging
Imaging APIs for the XP Framework
Installs: 51 843
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: >=7.4.0
- ext-gd: *
- xp-framework/core: ^12.0 | ^11.0 | ^10.0
Requires (Dev)
- xp-framework/test: ^2.0 | ^1.0
README
Loading an image
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
use img\Image; $transformed= Image::create(640, 480, Image::TRUECOLOR); $transformed->resampleFrom($image);
Apply filters:
use img\filters\SharpenFilter; $transformed->apply(new SharpenFilter());
Convert:
use img\convert\GrayscaleConverter; $transformed->convertTo(new GrayscaleConverter());
Saving an image
use img\io\JpegStreamWriter; use io\File; $transformed->saveTo(new JpegStreamWriter(new File('transformed.jpeg'), 100));