Imagine API
Interface

Imagine\Image\ImageInterface

interface ImageInterface implements ManipulatorInterface

Constants

RESOLUTION_PIXELSPERINCH

RESOLUTION_PIXELSPERCENTIMETER

Methods

ManipulatorInterface copy()

Copies current source image into a new ImageInterface instance

from ManipulatorInterface
ManipulatorInterface crop(PointInterface $start, BoxInterface $size)

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

from ManipulatorInterface
ManipulatorInterface resize(BoxInterface $size)

Resizes current image and returns self

from ManipulatorInterface
ManipulatorInterface rotate(integer $angle, Color $background = null)

Rotates an image at the given angle.

from ManipulatorInterface
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

from ManipulatorInterface
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

from ManipulatorInterface
ManipulatorInterface show(string $format, array $options = array())

Outputs the image content

from ManipulatorInterface
ManipulatorInterface flipHorizontally()

Flips current image using horizontal axis

from ManipulatorInterface
ManipulatorInterface flipVertically()

Flips current image using vertical axis

from ManipulatorInterface
ManipulatorInterface strip()

Remove all profiles and comments

from ManipulatorInterface
ManipulatorInterface thumbnail(BoxInterface $size, string $mode = self::THUMBNAIL_INSET)

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

from ManipulatorInterface
ManipulatorInterface applyMask(ImageInterface $mask)

Applies a given mask to current image's alpha channel

from ManipulatorInterface
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

from ManipulatorInterface
string get(string $format, array $options = array())

Returns the image content as a binary string

string __toString()

Returns the image content as a PNG binary string

DrawerInterface draw()

Instantiates and returns a DrawerInterface instance for image drawing

EffectsInterface effects()

BoxInterface getSize()

Returns current image size

ImageInterface mask()

Transforms creates a grayscale mask from current image, returns a new image, while keeping the existing image unmodified

array histogram()

Returns array of image colors as Imagine\Image\Color instances

Color getColorAt(PointInterface $point)

Returns color at specified positions of current image

Details

in ManipulatorInterface at line 34
public ManipulatorInterface copy()

Copies current source image into a new ImageInterface instance

Return Value

ManipulatorInterface

Exceptions

RuntimeException

in ManipulatorInterface at line 48
public ManipulatorInterface crop(PointInterface $start, BoxInterface $size)

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

in ManipulatorInterface at line 59
public ManipulatorInterface resize(BoxInterface $size)

Resizes current image and returns self

Parameters

BoxInterface $size

Return Value

ManipulatorInterface

Exceptions

RuntimeException

in ManipulatorInterface at line 73
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

in ManipulatorInterface at line 91
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

in ManipulatorInterface at line 105
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

in ManipulatorInterface at line 117
public ManipulatorInterface show(string $format, array $options = array())

Outputs the image content

Parameters

string $format
array $options

Return Value

ManipulatorInterface

Exceptions

RuntimeException

in ManipulatorInterface at line 126
public ManipulatorInterface flipHorizontally()

Flips current image using horizontal axis

Return Value

ManipulatorInterface

Exceptions

RuntimeException

in ManipulatorInterface at line 135
public ManipulatorInterface flipVertically()

Flips current image using vertical axis

Return Value

ManipulatorInterface

Exceptions

RuntimeException

in ManipulatorInterface at line 144
public ManipulatorInterface strip()

Remove all profiles and comments

Return Value

ManipulatorInterface

Exceptions

RuntimeException

in ManipulatorInterface at line 157
public ManipulatorInterface thumbnail(BoxInterface $size, string $mode = self::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

in ManipulatorInterface at line 166
public ManipulatorInterface applyMask(ImageInterface $mask)

Applies a given mask to current image's alpha channel

Parameters

ImageInterface $mask

Return Value

ManipulatorInterface

in ManipulatorInterface at line 177
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 36
public string get(string $format, array $options = array())

Returns the image content as a binary string

Parameters

string $format
array $options

Return Value

string binary

Exceptions

RuntimeException

at line 45
public string __toString()

Returns the image content as a PNG binary string

Return Value

string binary

Exceptions

RuntimeException

at line 52
public DrawerInterface draw()

Instantiates and returns a DrawerInterface instance for image drawing

Return Value

DrawerInterface

at line 57
public EffectsInterface effects()

Return Value

EffectsInterface

at line 64
public BoxInterface getSize()

Returns current image size

Return Value

BoxInterface

at line 72
public ImageInterface mask()

Transforms creates a grayscale mask from current image, returns a new image, while keeping the existing image unmodified

Return Value

ImageInterface

at line 79
public array histogram()

Returns array of image colors as Imagine\Image\Color instances

Return Value

array

at line 90
public Color getColorAt(PointInterface $point)

Returns color at specified positions of current image

Parameters

PointInterface $point

Return Value

Color

Exceptions

RuntimeException