Php imagick
From JasonAntmanWiki
imagick is a PHP library to interface to ImageMagick, a simple command line program and API for image manipulation.
Overview
Here is a simple overview of the use of imagick:
Useful commands
- addImage -
bool Imagick::addImage ( Imagick $source )
- adds a new image to the object list - annotateImage -
bool Imagick::annotateImage ( ImagickDraw $draw_settings, float $x, float $y, float $angle, string $text )
- adds text to an image - clear -
bool Imagick::clear ( void )
- clear all resources related to an object - compositeIMage -
bool Imagick::compositeImage ( Imagick $composite_object, int $composite, int $x, int $y [, int $channel] )
- composite one image onto another - cropImage -
bool Imagick::cropImage ( int $width, int $height, int $x, int $y )
- extract a region of an image - destroy -
bool Imagick::destroy ( void )
- destroy imagick object - drawImage -
bool Imagick::drawImage ( ImagickDraw $drawing_wand )
- render ImagickDrawing object on current image. - flattenImages -
bool Imagick::flattenImages ( void )
- flatten images - getFileName -
string Imagick::getFilename ( void )
- get filename associated with a sequence of images - getImageSize -
int Imagick::getImageSize ( void )
- get image size in bytes - getImageGeometry -
array Imagick::getImageGeometry ( void )
- get image height and width as associative array - getImageRegion -
bool Imagick::getImageRegion ( int $width, int $height, int $x, int $y )
- extract a region of the image - getImage -
Imagick Imagick::getImage ( void )
returns a new Imagick object - newImage -
bool Imagick::newImage ( int $cols, int $rows, ImagickPixel $background [, string $format] )
- creates a new image - readImage -
bool Imagick::readImage ( string $filename )
- reads an image from a filename - setBackgroundColor -
bool Imagick::setBackgroundColor ( ImagickPixel $background )
- set background color - setFilename -
bool Imagick::setFilename ( string $filename )
- set an image's filename before writing out - setFormat -
bool Imagick::setFormat ( string $format )
- set the format of the image - setImageResolution -
bool Imagick::setImageResolution ( float $x_resolution, float $y_resolution )
- sets the image resolution - setPage -
bool Imagick::setPage ( int $width, int $height, int $x, int $y )
- sets the page geometry - setSize -
bool Imagick::setSize ( int $columns, int $rows )
- sets image size - writeImage -
bool Imagick::writeImage ( [string $filename] )
- writes the image out (to specified filename)
ImagickDraw
- annotation -
bool ImagickDraw::annotation ( float $x, float $y, string $text )
- draw text on the image - draw-arc -
bool ImagickDraw::arc ( float $sx, float $sy, float $ex, float $ey, float $sd, float $ed )
- draw an arc - composite -
bool ImagickDraw::composite ( int $compose, float $x, float $y, float $width, float $height, Imagick $compositeWand )
- composite an image onto the current image - __construct -
ImagickDraw ImagickDraw::__construct ( void )
- ImagickDraw constructor - destroy -
bool ImagickDraw::destroy ( void )
- frees all associated resources - line -
bool ImagickDraw::line ( float $sx, float $sy, float $ex, float $ey )
- draws a line - polygon -
bool ImagickDraw::polygon ( array $coordinates )
- draws a polygon from an array of coordinates - polyline -
bool ImagickDraw::polyline ( array $coordinates )
- draws a polyline from an array of coordinates - render
bool ImagickDraw::render ( void )
- Renders all preceding drawing commands onto the image - setFillColor -
bool ImagickDraw::setFillColor ( ImagickPixel $fill_pixel )
- Sets the fill color to be used for drawing filled objects - setFontFamily -
bool ImagickDraw::setFontFamily ( string $font_family )
- Sets the font family to use when annotating with text - setFontSize -
bool ImagickDraw::setFontSize ( float $pointsize )
- sets font pointsize to use for annotation text - setFontStyle -
bool ImagickDraw::setFontStyle ( int $style )
- set font style to use when annotating with text - setFontWeight -
bool ImagickDraw::setFontWeight ( int $font_weight )
- set font weight - setFont -
bool ImagickDraw::setFont ( string $font_name )
- set font name - setGravity -
bool ImagickDraw::setGravity ( int $gravity )
- set font gravity for text annotations - setTextAlignment -
bool ImagickDraw::setTextAlignment ( int $alignment )
- set text alignment for annotations