- Classes
- Namespaces
- Interfaces
- Index

Imagine API
Class

# Imagine\Filter\Transformation

class Transformation implements FilterInterface, ManipulatorInterface

A transformation filter

## Methods

| __construct(ImagineInterface $imagine = null) Class constructor. |
ImageInterface | applyFilter(ImageInterface $image, FilterInterface $filter) Applies a given FilterInterface onto given ImageInterface and returns modified ImageInterface |
ImageInterface | apply(ImageInterface $image) Applies scheduled transformation to ImageInterface instance Returns processed ImageInterface instance |
ManipulatorInterface | copy() Copies current source image into a new ImageInterface instance |
ManipulatorInterface | crop(PointInterface $start, BoxInterface $size) Crops a specified box out of the source image (modifies the source image) Returns cropped self |
ManipulatorInterface | flipHorizontally() Flips current image using horizontal axis |
ManipulatorInterface | flipVertically() Flips current image using vertical axis |
ManipulatorInterface | strip() Remove all profiles and comments |
ManipulatorInterface | paste(ImageInterface $image, PointInterface $start) Pastes an image into a parent image Throws exceptions if image exceeds parent image borders or if paste operation fails |
ManipulatorInterface | applyMask(ImageInterface $mask) Applies a given mask to current image's alpha channel |
ManipulatorInterface | fill(FillInterface $fill) Fills image with provided filling, by replacing each pixel's color in the current image with corresponding color from FillInterface, and returns modified image |
ManipulatorInterface | resize(BoxInterface $size, string $filter = ImageInterface::FILTER_UNDEFINED) Resizes current image and returns self |
ManipulatorInterface | rotate(integer $angle, Color $background = null) Rotates an image at the given angle. |
ManipulatorInterface | save(string $path, array $options = array()) Saves the image at a specified path, the target file extension is used to determine file format, only jpg, jpeg, gif, png, wbmp and xbm are supported |
ManipulatorInterface | show(string $format, array $options = array()) Outputs the image content |
ManipulatorInterface | thumbnail(BoxInterface $size, string $mode = ImageInterface::THUMBNAIL_INSET) Generates a thumbnail from a current image Returns it as a new image, doesn't modify the current image |
Transformation | add(FilterInterface $filter) Registers a given FilterInterface in an internal array of filters for later application to an instance of ImageInterface |

## Details

###
at line 58
`public __construct(ImagineInterface $imagine = null)`

Class constructor.

#### Parameters

ImagineInterface | $imagine | An ImagineInterface instance

###
at line 73
`public ImageInterface applyFilter(ImageInterface $image, FilterInterface $filter)`

Applies a given FilterInterface onto given ImageInterface and returns modified ImageInterface

#### Parameters

ImageInterface | $image |
FilterInterface | $filter |

#### Return Value

ImageInterface |

#### Exceptions

InvalidArgumentException |

###
at line 91
`public ImageInterface apply(ImageInterface $image)`

Applies scheduled transformation to ImageInterface instance Returns processed ImageInterface instance

#### Parameters

ImageInterface | $image |

#### Return Value

ImageInterface |

###
at line 103
`public ManipulatorInterface copy()`

Copies current source image into a new ImageInterface instance

#### Return Value

ManipulatorInterface |

#### Exceptions

RuntimeException |

###
at line 111
`public ManipulatorInterface crop(PointInterface $start, BoxInterface $size)`

Crops a specified box out of the source image (modifies the source image) Returns cropped self

#### Parameters

PointInterface | $start |
BoxInterface | $size |

#### Return Value

ManipulatorInterface |

#### Exceptions

OutOfBoundsException |
RuntimeException |

###
at line 119
`public ManipulatorInterface flipHorizontally()`

Flips current image using horizontal axis

#### Return Value

ManipulatorInterface |

#### Exceptions

RuntimeException |

###
at line 127
`public ManipulatorInterface flipVertically()`

Flips current image using vertical axis

#### Return Value

ManipulatorInterface |

#### Exceptions

RuntimeException |

###
at line 135
`public ManipulatorInterface strip()`

Remove all profiles and comments

#### Return Value

ManipulatorInterface |

#### Exceptions

RuntimeException |

###
at line 143
`public ManipulatorInterface paste(ImageInterface $image, PointInterface $start)`

Pastes an image into a parent image Throws exceptions if image exceeds parent image borders or if paste operation fails

Returns source image

#### Parameters

ImageInterface | $image |
PointInterface | $start |

#### Return Value

ManipulatorInterface |

#### Exceptions

InvalidArgumentException |
OutOfBoundsException |
RuntimeException |

###
at line 151
`public ManipulatorInterface applyMask(ImageInterface $mask)`

Applies a given mask to current image's alpha channel

#### Parameters

ImageInterface | $mask |

#### Return Value

ManipulatorInterface |

###
at line 159
`public ManipulatorInterface fill(FillInterface $fill)`

Fills image with provided filling, by replacing each pixel's color in the current image with corresponding color from FillInterface, and returns modified image

#### Parameters

FillInterface | $fill |

#### Return Value

ManipulatorInterface |

###
at line 167
`public ManipulatorInterface resize(BoxInterface $size, string $filter = ImageInterface::FILTER_UNDEFINED)`

Resizes current image and returns self

#### Parameters

BoxInterface | $size |
string | $filter |

#### Return Value

ManipulatorInterface |

#### Exceptions

RuntimeException |

###
at line 175
`public ManipulatorInterface rotate(integer $angle, Color $background = null)`

Rotates an image at the given angle.

Optional $background can be used to specify the fill color of the empty area of rotated image.

#### Parameters

integer | $angle |
Color | $background |

#### Return Value

ManipulatorInterface |

#### Exceptions

RuntimeException |

###
at line 183
`public ManipulatorInterface save(string $path, array $options = array())`

Saves the image at a specified path, the target file extension is used to determine file format, only jpg, jpeg, gif, png, wbmp and xbm are supported

#### Parameters

string | $path |
array | $options |

#### Return Value

ManipulatorInterface |

#### Exceptions

RuntimeException |

###
at line 191
`public ManipulatorInterface show(string $format, array $options = array())`

Outputs the image content

#### Parameters

string | $format |
array | $options |

#### Return Value

ManipulatorInterface |

#### Exceptions

RuntimeException |

###
at line 199
`public ManipulatorInterface thumbnail(BoxInterface $size, string $mode = ImageInterface::THUMBNAIL_INSET)`

Generates a thumbnail from a current image Returns it as a new image, doesn't modify the current image

#### Parameters

BoxInterface | $size |
string | $mode |

#### Return Value

ManipulatorInterface |

#### Exceptions

RuntimeException |

###
at line 212
`public Transformation add(FilterInterface $filter)`

Registers a given FilterInterface in an internal array of filters for later application to an instance of ImageInterface

#### Parameters

FilterInterface | $filter |

#### Return Value

Transformation |