graphicsImagick
extends graphicsBase
in package
Class for image handling using the Imagick library
Requires Imagick 3.0.0+ and ImageMagick 6.3.8+
Tags
Table of Contents
Properties
- $fontlist : mixed
- $gd_loaded : mixed
- $gd_present : mixed
- $generalinfo : mixed
- $imagemagick_version : mixed
- $imagemagick_version_pass : mixed
- $imagick_present : mixed
- $imagick_version : mixed
- $imagick_version_pass : mixed
- $info : mixed
Methods
- __construct() : mixed
- checkGraphicSupport() : mixed
- Check if a required graphics libary is available on the system Mzst be called by every graphics class related constructor to ensure that general properties are set properly
- colorAllocate() : ImagickPixel
- Returns an RGB color identifier
- copyCanvas() : bool
- Copies an image canvas
- createImage() : Imagick
- Creates a true color image
- drawRectangle() : bool
- Creates a rectangle
- flipImage() : object
- Flips (mirrors) an image
- flipRotateImage() : object|false
- Rotates and/or flips an image based on by using rotateImage() and flipImage() methods
- getCounterClockwiseRotation() : int
- Returns the counter clockwise rotation degree the GD library requires
- getFonts() : array<string|int, mixed>
- Returns a list of available fonts
- graphicsLibInfo() : mixed
- imageBlurGD() : mixed
- imageCanRotate() : bool
- Returns true if Imagick library is configured with image rotation support
- imageColorTransparent() : bool
- Sets the transparency color
- imageDims() : mixed
- imageFill() : bool
- Fills an image area
- imageFontHeight() : int
- Returns the font height in pixels
- imageFontWidth() : int
- Returns the font width in pixels
- imageFromString() : Imagick
- Creates an image from an image stream
- imageGet() : Imagick
- Takes an image filename and returns an Imagick image object
- imageGray() : Imagick
- Creates a grayscale image
- imageHeight() : int
- Returns the height of an image resource
- imageIPTC() : mixed
- imageKill() : bool
- Destroys an image resource
- imageLoadFont() : ImagickDraw
- Loads a font and returns an object with the font loaded
- imageMerge() : bool
- Does a copy merge of two image resources
- imageOutput() : bool
- Outputs an image resource as a given type
- imageResizeAlpha() : Imagick
- Resize a file with transparency to given dimensions and still retain the alpha channel information
- imageResizeTransparent() : type
- Uses imageResizeAlpha() internally as Imagick does not make a difference
- imageUnsharpMask() : Imagick
- Sharpens an image using an Unsharp Mask filter.
- imageWidth() : int
- Returns the width of an image resource
- resampleImage() : bool
- Resamples an image to a new copy
- rotateImage() : Imagick
- Rotates an image resource according to its Orientation setting
- writeString() : bool
- Renders a string into the image
Properties
$fontlist
public
mixed
$fontlist
= array()
$gd_loaded
public
mixed
$gd_loaded
= \false
$gd_present
public
mixed
$gd_present
= \false
$generalinfo
public
mixed
$generalinfo
= array()
$imagemagick_version
public
mixed
$imagemagick_version
= ''
$imagemagick_version_pass
public
mixed
$imagemagick_version_pass
= \false
$imagick_present
public
mixed
$imagick_present
= \false
$imagick_version
public
mixed
$imagick_version
= ''
$imagick_version_pass
public
mixed
$imagick_version_pass
= \false
$info
public
mixed
$info
= array()
Methods
__construct()
public
__construct() : mixed
checkGraphicSupport()
Check if a required graphics libary is available on the system Mzst be called by every graphics class related constructor to ensure that general properties are set properly
public
checkGraphicSupport() : mixed
Tags
colorAllocate()
Returns an RGB color identifier
public
colorAllocate(Imagick $image, int $red, int $green, int $blue) : ImagickPixel
Parameters
- $image : Imagick
- $red : int
- $green : int
- $blue : int
Return values
ImagickPixelcopyCanvas()
Copies an image canvas
public
copyCanvas(Imagick $imgCanvas, Imagick $img, int $dest_x, int $dest_y, int $src_x, int $src_y, int $w, int $h) : bool
Parameters
- $imgCanvas : Imagick
-
destination canvas
- $img : Imagick
-
source canvas
- $dest_x : int
-
destination x
- $dest_y : int
-
destination y
- $src_x : int
-
source x
- $src_y : int
-
source y
- $w : int
-
width
- $h : int
-
height
Return values
boolcreateImage()
Creates a true color image
public
createImage(int $w, int $h[, bool $truecolor = true ]) : Imagick
Parameters
- $w : int
-
the width of the image
- $h : int
-
the height of the image
- $truecolor : bool = true
-
True to create a true color image, false for usage with palette images like gifs
Return values
ImagickdrawRectangle()
Creates a rectangle
public
drawRectangle(Imagick $image, int $x1, int $y1, int $x2, int $y2, ImagickPixel $color) : bool
Parameters
- $image : Imagick
- $x1 : int
- $y1 : int
- $x2 : int
- $y2 : int
- $color : ImagickPixel
Return values
boolflipImage()
Flips (mirrors) an image
public
flipImage(image $im[, string $mode = 'horizontal' ]) : object
Parameters
- $im : image
- $mode : string = 'horizontal'
-
"horizontal" (default) or "vertical"
Tags
Return values
objectflipRotateImage()
Rotates and/or flips an image based on by using rotateImage() and flipImage() methods
public
flipRotateImage(object $im, array<string|int, mixed> $rotate) : object|false
Parameters
- $im : object
-
GDImage or imagick image object
- $rotate : array<string|int, mixed>
-
Two dimensional array with rotate and flip indexes as returned be getImageRotation()
Tags
Return values
object|falsegetCounterClockwiseRotation()
Returns the counter clockwise rotation degree the GD library requires
public
static getCounterClockwiseRotation(int $degree) : int
Parameters
- $degree : int
-
Rotation degree clockwise
Tags
Return values
intgetFonts()
Returns a list of available fonts
public
getFonts() : array<string|int, mixed>
Return values
array<string|int, mixed>graphicsLibInfo()
public
graphicsLibInfo() : mixed
imageBlurGD()
public
imageBlurGD(mixed $imgCanvas, mixed $imgCanvas2, mixed $radius, mixed $w, mixed $h) : mixed
Parameters
- $imgCanvas : mixed
- $imgCanvas2 : mixed
- $radius : mixed
- $w : mixed
- $h : mixed
imageCanRotate()
Returns true if Imagick library is configured with image rotation support
public
imageCanRotate() : bool
Return values
boolimageColorTransparent()
Sets the transparency color
public
imageColorTransparent(Imagick $image, color $color) : bool
Parameters
- $image : Imagick
- $color : color
Return values
boolimageDims()
public
imageDims(mixed $filename) : mixed
Parameters
- $filename : mixed
imageFill()
Fills an image area
public
imageFill(Imagick $image, int $x, int $y, color $color) : bool
Parameters
- $image : Imagick
- $x : int
- $y : int
- $color : color
Return values
boolimageFontHeight()
Returns the font height in pixels
public
imageFontHeight(ImagickDraw $font) : int
Parameters
- $font : ImagickDraw
Return values
intimageFontWidth()
Returns the font width in pixels
public
imageFontWidth(ImagickDraw $font) : int
Parameters
- $font : ImagickDraw
Return values
intimageFromString()
Creates an image from an image stream
public
imageFromString(mixed $string) : Imagick
Parameters
- $string : mixed
Return values
ImagickimageGet()
Takes an image filename and returns an Imagick image object
public
imageGet(string $imgfile) : Imagick
Parameters
- $imgfile : string
-
the full path and filename of the image to load
Return values
ImagickimageGray()
Creates a grayscale image
public
imageGray(Imagick $image) : Imagick
Parameters
- $image : Imagick
-
The image to grayscale
Return values
ImagickimageHeight()
Returns the height of an image resource
public
imageHeight(Imagick $im) : int
Parameters
- $im : Imagick
Return values
intimageIPTC()
public
imageIPTC(mixed $filename) : mixed
Parameters
- $filename : mixed
imageKill()
Destroys an image resource
public
imageKill(Imagick $im) : bool
Parameters
- $im : Imagick
Return values
boolimageLoadFont()
Loads a font and returns an object with the font loaded
public
imageLoadFont([string $font = NULL ][, mixed $size = 18 ]) : ImagickDraw
Parameters
- $font : string = NULL
- $size : mixed = 18
Return values
ImagickDrawimageMerge()
Does a copy merge of two image resources
public
imageMerge(Imagick $dst_im, Imagick $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_w, int $src_h, int $pct) : bool
Parameters
- $dst_im : Imagick
- $src_im : Imagick
- $dst_x : int
- $dst_y : int
- $src_x : int
- $src_y : int
- $src_w : int
- $src_h : int
- $pct : int
Return values
boolimageOutput()
Outputs an image resource as a given type
public
imageOutput(Imagick $im, string $type[, string $filename = NULL ][, int $qual = 75 ]) : bool
Parameters
- $im : Imagick
- $type : string
- $filename : string = NULL
- $qual : int = 75
Return values
boolimageResizeAlpha()
Resize a file with transparency to given dimensions and still retain the alpha channel information
public
imageResizeAlpha(Imagick $src, int $w, int $h) : Imagick
Parameters
- $src : Imagick
- $w : int
- $h : int
Return values
ImagickimageResizeTransparent()
Uses imageResizeAlpha() internally as Imagick does not make a difference
public
imageResizeTransparent(type $src, type $w, type $h) : type
Parameters
- $src : type
- $w : type
- $h : type
Return values
typeimageUnsharpMask()
Sharpens an image using an Unsharp Mask filter.
public
imageUnsharpMask(Imagick $img, int $amount, int $radius, int $threshold) : Imagick
Parameters
- $img : Imagick
-
the image to sharpen
- $amount : int
-
the strength of the sharpening effect
- $radius : int
-
the pixel radius of the sharpening mask
- $threshold : int
-
the color difference threshold required for sharpening
Return values
ImagickimageWidth()
Returns the width of an image resource
public
imageWidth(Imagick $im) : int
Parameters
- $im : Imagick
Return values
intresampleImage()
Resamples an image to a new copy
public
resampleImage(Imagick $dst_image, Imagick $src_image, int $dst_x, int $dst_y, int $src_x, int $src_y, int $dst_w, int $dst_h, int $src_w, int $src_h) : bool
Parameters
- $dst_image : Imagick
- $src_image : Imagick
- $dst_x : int
- $dst_y : int
- $src_x : int
- $src_y : int
- $dst_w : int
- $dst_h : int
- $src_w : int
- $src_h : int
Return values
boolrotateImage()
Rotates an image resource according to its Orientation setting
public
rotateImage(Imagick $im, int $rotate) : Imagick
Parameters
- $im : Imagick
-
Imagick object
- $rotate : int
-
Rotation degree clock wise
Return values
ImagickwriteString()
Renders a string into the image
public
writeString(Imagick $image, ImagickDraw $font, int $x, int $y, string $string, ImagickPixel $color) : bool
Parameters
- $image : Imagick
- $font : ImagickDraw
- $x : int
- $y : int
- $string : string
- $color : ImagickPixel