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).

  1. $image = WideImage::load('image.png');
  2. $resizedImage = $image->resize(50, 50);
  3. // $image is a different image object than $resizedImage

You can chain the operations:

  1. $originalImage = WideImage::load('image.png');
  2. $newImage = $image->resize(200, 100)->crop(50, 50, 30, 20)->rotate(20);
  3.  
  4. // and:
  5. $newImage = WideImage::load('image.png')->resize(200, 200)->rotate(20);
  6.  
  7. // or just load, operate, save:
  8. WideImage::load('a.png')->resize(90, 70)->rotate(20)->saveToFile('b.jpg');

The main implemented operations are (left out a few less important):

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).

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Reddit
  • Tumblr
  • Twitter