Manipulating images
In WideImage, you manipulate the images by calling the appropriate operation method on the image object. Every operation returns a new Image object (for the nerds: this is basically a value object).
-
$image = WideImage::load('image.png');
-
$resizedImage = $image->resize(50, 50);
-
// $image is a different image object than $resizedImage
You can chain the operations:
-
$originalImage = WideImage::load('image.png');
-
$newImage = $image->resize(200, 100)->crop(50, 50, 30, 20)->rotate(20);
-
-
// and:
-
$newImage = WideImage::load('image.png')->resize(200, 200)->rotate(20);
-
-
// or just load, operate, save:
-
WideImage::load('a.png')->resize(90, 70)->rotate(20)->saveToFile('b.jpg');
The main implemented operations are (left out a few less important):
- asNegative (demo, API doc)
- asGrayscale (demo, API doc)
- getChannels (demo, API doc)
- getMask (demo, API doc)
- applyMask (demo, API doc)
- merge (demo, API doc)
- resize (demo, API doc)
- resizeCanvas (demo, API doc)
- crop (demo, API doc)
- autoCrop (demo, API doc)
- roundCorners (demo, API doc)
- rotate (demo, API doc)
- mirror (demo, API doc)
- flip (demo, API doc)
- canvas drawing (demo, API doc)
- unsharp (demo, API doc)
- applyFilter (demo, API doc)
- addNoise (demo, API doc)
- applyConvolution (demo, API doc)
- correctGamma (demo, API doc)
Some of these operations are explained in examples section, and all of them are documented in API documentation. A few of these operations (i.e. rotate, applyConvolution) don’t work on Debian-based Linux systems (such as Ubuntu).


