class Gmagick (View source)

Constants

COLOR_BLACK

COLOR_BLUE

COLOR_CYAN

COLOR_GREEN

COLOR_RED

COLOR_YELLOW

COLOR_MAGENTA

COLOR_OPACITY

COLOR_ALPHA

COLOR_FUZZ

GMAGICK_EXTNUM

COMPOSITE_DEFAULT

COMPOSITE_UNDEFINED

COMPOSITE_NO

COMPOSITE_ADD

COMPOSITE_ATOP

COMPOSITE_BUMPMAP

COMPOSITE_CLEAR

COMPOSITE_COLORIZE

COMPOSITE_COPYBLACK

COMPOSITE_COPYBLUE

COMPOSITE_COPY

COMPOSITE_COPYCYAN

COMPOSITE_COPYGREEN

COMPOSITE_COPYMAGENTA

COMPOSITE_COPYOPACITY

COMPOSITE_COPYRED

COMPOSITE_COPYYELLOW

COMPOSITE_DARKEN

COMPOSITE_DIFFERENCE

COMPOSITE_DISPLACE

COMPOSITE_DISSOLVE

COMPOSITE_HUE

COMPOSITE_IN

COMPOSITE_LIGHTEN

COMPOSITE_LUMINIZE

COMPOSITE_MINUS

COMPOSITE_MODULATE

COMPOSITE_MULTIPLY

COMPOSITE_OUT

COMPOSITE_OVER

COMPOSITE_OVERLAY

COMPOSITE_PLUS

COMPOSITE_REPLACE

COMPOSITE_SATURATE

COMPOSITE_SCREEN

COMPOSITE_SUBTRACT

COMPOSITE_THRESHOLD

COMPOSITE_XOR

COMPOSITE_DIVIDE

COMPOSITE_HARDLIGHT

COMPOSITE_EXCLUSION

COMPOSITE_COLORDODGE

COMPOSITE_COLORBURN

COMPOSITE_SOFTLIGHT

COMPOSITE_LINEARBURN

COMPOSITE_LINEARDODGE

COMPOSITE_LINEARLIGHT

COMPOSITE_VIVIDLIGHT

COMPOSITE_PINLIGHT

COMPOSITE_HARDMIX

MONTAGEMODE_FRAME

MONTAGEMODE_UNFRAME

MONTAGEMODE_CONCATENATE

STYLE_NORMAL

STYLE_ITALIC

STYLE_OBLIQUE

STYLE_ANY

FILTER_UNDEFINED

FILTER_POINT

FILTER_BOX

FILTER_TRIANGLE

FILTER_HERMITE

FILTER_HANNING

FILTER_HAMMING

FILTER_BLACKMAN

FILTER_GAUSSIAN

FILTER_QUADRATIC

FILTER_CUBIC

FILTER_CATROM

FILTER_MITCHELL

FILTER_LANCZOS

FILTER_BESSEL

FILTER_SINC

IMGTYPE_UNDEFINED

IMGTYPE_BILEVEL

IMGTYPE_GRAYSCALE

IMGTYPE_GRAYSCALEMATTE

IMGTYPE_PALETTE

IMGTYPE_PALETTEMATTE

IMGTYPE_TRUECOLOR

IMGTYPE_TRUECOLORMATTE

IMGTYPE_COLORSEPARATION

IMGTYPE_COLORSEPARATIONMATTE

IMGTYPE_OPTIMIZE

RESOLUTION_UNDEFINED

RESOLUTION_PIXELSPERINCH

RESOLUTION_PIXELSPERCENTIMETER

COMPRESSION_UNDEFINED

COMPRESSION_NO

COMPRESSION_BZIP

COMPRESSION_FAX

COMPRESSION_GROUP4

COMPRESSION_JPEG

COMPRESSION_LOSSLESSJPEG

COMPRESSION_LZW

COMPRESSION_RLE

COMPRESSION_ZIP

COMPRESSION_GROUP3

COMPRESSION_LZMA

COMPRESSION_JPEG2000

COMPRESSION_JBIG1

COMPRESSION_JBIG2

INTERLACE_NONE

INTERLACE_LINE

INTERLACE_PLANE

INTERLACE_PARTITION

PAINT_POINT

PAINT_REPLACE

PAINT_FLOODFILL

PAINT_FILLTOBORDER

PAINT_RESET

GRAVITY_NORTHWEST

GRAVITY_NORTH

GRAVITY_NORTHEAST

GRAVITY_WEST

GRAVITY_CENTER

GRAVITY_EAST

GRAVITY_SOUTHWEST

GRAVITY_SOUTH

GRAVITY_SOUTHEAST

STRETCH_NORMAL

STRETCH_ULTRACONDENSED

STRETCH_CONDENSED

STRETCH_SEMICONDENSED

STRETCH_SEMIEXPANDED

STRETCH_EXPANDED

STRETCH_EXTRAEXPANDED

STRETCH_ULTRAEXPANDED

STRETCH_ANY

STRETCH_EXTRACONDENSED

ALIGN_UNDEFINED

ALIGN_LEFT

ALIGN_CENTER

ALIGN_RIGHT

DECORATION_NO

DECORATION_UNDERLINE

DECORATION_OVERLINE

DECORATION_LINETROUGH

NOISE_UNIFORM

NOISE_GAUSSIAN

NOISE_MULTIPLICATIVEGAUSSIAN

NOISE_IMPULSE

NOISE_LAPLACIAN

NOISE_POISSON

NOISE_RANDOM

CHANNEL_UNDEFINED

CHANNEL_RED

CHANNEL_GRAY

CHANNEL_CYAN

CHANNEL_GREEN

CHANNEL_MAGENTA

CHANNEL_BLUE

CHANNEL_YELLOW

CHANNEL_OPACITY

CHANNEL_MATTE

CHANNEL_BLACK

CHANNEL_INDEX

CHANNEL_ALL

CHANNEL_DEFAULT

METRIC_UNDEFINED

METRIC_MEANABSOLUTEERROR

METRIC_MEANSQUAREERROR

METRIC_PEAKABSOLUTEERROR

METRIC_PEAKSIGNALTONOISERATIO

METRIC_ROOTMEANSQUAREDERROR

PIXEL_CHAR

PIXEL_DOUBLE

PIXEL_FLOAT

PIXEL_INTEGER

PIXEL_LONG

PIXEL_SHORT

COLORSPACE_UNDEFINED

COLORSPACE_RGB

COLORSPACE_GRAY

COLORSPACE_TRANSPARENT

COLORSPACE_OHTA

COLORSPACE_LAB

COLORSPACE_XYZ

COLORSPACE_YCBCR

COLORSPACE_YCC

COLORSPACE_YIQ

COLORSPACE_YPBPR

COLORSPACE_YUV

COLORSPACE_CMYK

COLORSPACE_SRGB

COLORSPACE_HSL

COLORSPACE_HWB

COLORSPACE_REC601LUMA

COLORSPACE_REC709LUMA

COLORSPACE_CINEONLOGRGB

COLORSPACE_REC601YCBCR

COLORSPACE_REC709YCBCR

VIRTUALPIXELMETHOD_UNDEFINED

VIRTUALPIXELMETHOD_CONSTANT

VIRTUALPIXELMETHOD_EDGE

VIRTUALPIXELMETHOD_MIRROR

VIRTUALPIXELMETHOD_TILE

PREVIEW_UNDEFINED

PREVIEW_ROTATE

PREVIEW_SHEAR

PREVIEW_ROLL

PREVIEW_HUE

PREVIEW_SATURATION

PREVIEW_BRIGHTNESS

PREVIEW_GAMMA

PREVIEW_SPIFF

PREVIEW_DULL

PREVIEW_GRAYSCALE

PREVIEW_QUANTIZE

PREVIEW_DESPECKLE

PREVIEW_REDUCENOISE

PREVIEW_ADDNOISE

PREVIEW_SHARPEN

PREVIEW_BLUR

PREVIEW_THRESHOLD

PREVIEW_EDGEDETECT

PREVIEW_SPREAD

PREVIEW_SOLARIZE

PREVIEW_SHADE

PREVIEW_RAISE

PREVIEW_SEGMENT

PREVIEW_SWIRL

PREVIEW_IMPLODE

PREVIEW_WAVE

PREVIEW_OILPAINT

PREVIEW_CHARCOALDRAWING

PREVIEW_JPEG

RENDERINGINTENT_UNDEFINED

RENDERINGINTENT_SATURATION

RENDERINGINTENT_PERCEPTUAL

RENDERINGINTENT_ABSOLUTE

RENDERINGINTENT_RELATIVE

INTERLACE_UNDEFINED

INTERLACE_NO

FILLRULE_UNDEFINED

FILLRULE_EVENODD

FILLRULE_NONZERO

PATHUNITS_USERSPACE

PATHUNITS_USERSPACEONUSE

PATHUNITS_OBJECTBOUNDINGBOX

LINECAP_UNDEFINED

LINECAP_BUTT

LINECAP_ROUND

LINECAP_SQUARE

LINEJOIN_UNDEFINED

LINEJOIN_MITER

LINEJOIN_ROUND

LINEJOIN_BEVEL

RESOURCETYPE_UNDEFINED

RESOURCETYPE_AREA

RESOURCETYPE_DISK

RESOURCETYPE_FILE

RESOURCETYPE_MAP

RESOURCETYPE_MEMORY

RESOURCETYPE_PIXELS

RESOURCETYPE_THREADS

RESOURCETYPE_WIDTH

RESOURCETYPE_HEIGHT

DISPOSE_UNDEFINED

DISPOSE_NONE

DISPOSE_BACKGROUND

DISPOSE_PREVIOUS

ORIENTATION_UNDEFINED

ORIENTATION_TOPLEFT

ORIENTATION_TOPRIGHT

ORIENTATION_BOTTOMRIGHT

ORIENTATION_BOTTOMLEFT

ORIENTATION_LEFTTOP

ORIENTATION_RIGHTTOP

ORIENTATION_RIGHTBOTTOM

ORIENTATION_LEFTBOTTOM

QUANTUM_DEPTH

QUANTUM

VERSION_LIB

VERSION_NUM

VERSION_TXT

Methods

__construct(string $filename = null)

The Gmagick constructor.

addimage(Gmagick $Gmagick)

Adds new image to Gmagick object from the current position of the source object.

addnoiseimage(int $NOISE)

Adds random noise to the image.

annotateimage(GmagickDraw $GmagickDraw, float $x, float $y, float $angle, string $text)

Annotates an image with text.

blurimage(float $radius, float $sigma, int $channel = null)

Adds blur filter to image.

borderimage(GmagickPixel $color, int $width, int $height)

Surrounds the image with a border of the color defined by the bordercolor GmagickPixel object or a color string.

charcoalimage(float $radius, float $sigma)

Simulates a charcoal drawing.

chopimage(int $width, int $height, int $x, int $y)

Removes a region of an image and collapses the image to occupy the removed portion.

clear()

Clears all resources associated to Gmagick object.

commentimage(string $comment)

Adds a comment to your image.

compositeimage(Gmagick $source, int $COMPOSE, int $x, int $y)

Composite one image onto another at the specified offset.

cropimage(int $width, int $height, int $x, int $y)

Extracts a region of the image.

cropthumbnailimage(int $width, int $height)

Creates a fixed size thumbnail by first scaling the image down and cropping a specified area from the center.

current()

Returns reference to the current gmagick object with image pointer at the correct sequence.

cyclecolormapimage(int $displace)

Displaces an image's colormap by a given number of positions.

deconstructimages()

Compares each image with the next in a sequence.

despeckleimage()

Reduces the speckle noise in an image while preserving the edges of the original image.

bool
destroy()

Destroys the Gmagick object and frees all resources associated with it.

drawimage(GmagickDraw $GmagickDraw)

Renders the GmagickDraw object on the current image.

edgeimage(float $radius)

Enhance edges within the image with a convolution filter of the given radius.

embossimage(float $radius, float $sigma)

Returns a grayscale image with a three-dimensional effect.

enhanceimage()

Applies a digital filter that improves the quality of a noisy image.

equalizeimage()

Equalizes the image histogram.

flipimage()

Creates a vertical mirror image by reflecting the pixels around the central x-axis.

flopimage()

Creates a horizontal mirror image by reflecting the pixels around the central y-axis.

frameimage(GmagickPixel $color, int $width, int $height, int $inner_bevel, int $outer_bevel)

Adds a simulated three-dimensional border around the image.

gammaimage(float $gamma)

Gamma-corrects an image.

string
getcopyright()

Returns the GraphicsMagick API copyright as a string.

string
getfilename()

Returns the filename associated with an image sequence.

getimagebackgroundcolor()

Returns the image background color.

array
getimageblueprimary()

Returns the chromaticity blue primary point for the image.

getimagebordercolor()

Returns the image border color.

int
getimagechanneldepth(int $channel_type)

Gets the depth for a particular image channel.

int
getimagecolors()

Returns the color of the specified colormap index.

int
getimagecolorspace()

Gets the image colorspace.

int
getimagecompose()

Returns the composite operator associated with the image.

int
getimagedelay()

Gets the image delay.

int
getimagedepth()

Gets the depth of the image.

int
getimagedispose()

Gets the image disposal method.

array
getimageextrema()

Gets the extrema for the image.

string
getimagefilename()

Returns the filename of a particular image in a sequence.

string
getimageformat()

Returns the format of a particular image in a sequence.

float
getimagegamma()

Gets the image gamma.

array
getimagegreenprimary()

Returns the chromaticy green primary point.

int
getimageheight()

Returns the image height.

array
getimagehistogram()

Gets the image histogram.

int
getimageindex()

Returns the index of the current active image within the Gmagick object.

int
getimageinterlacescheme()

Gets the image interlace scheme.

int
getimageiterations()

Gets the image iterations.

bool
getimagematte()

Checks if the image has a matte channel.

getimagemattecolor()

Returns the image matte color.

string
getimageprofile(string $name)

Returns the named image profile.

array
getimageredprimary()

Returns the chromaticity red primary point.

int
getimagerenderingintent()

Gets the image rendering intent.

array
getimageresolution()

Gets the image X and Y resolution.

int
getimagescene()

Gets the image scene.

string
getimagesignature()

Generates an SHA-256 message digest for the image pixel stream.

int
getimagetype()

Gets the potential image type.

int
getimageunits()

Gets the image units of resolution.

array
getimagewhitepoint()

Returns the chromaticity white point.

int
getimagewidth()

Returns the width of the image.

string
getpackagename()

Returns the GraphicsMagick package name.

array
getquantumdepth()

Returns the Gmagick quantum depth.

string
getreleasedate()

Returns the GraphicsMagick release date as a string.

array
getsamplingfactors()

Gets the horizontal and vertical sampling factor.

array
getsize()

Returns the size associated with the Gmagick object.

array
getversion()

Returns the GraphicsMagick API version.

bool
hasnextimage()

Checks if the object has more images.

bool
haspreviousimage()

Checks if the object has a previous image.

mixed
implodeimage(float $radius)

Creates a new image that is a copy of an existing one with the image pixels "imploded" by the specified percentage.

mixed
labelimage(string $label)

Adds a label to an image.

mixed
levelimage(float $blackPoint, float $gamma, float $whitePoint, int $channel = false)

Adjusts the levels of an image.

mixed
magnifyimage()

Scales an image proportionally 2x.

mapimage(gmagick $gmagick, bool $dither)

Replaces the colors of an image with the closest color from a reference image.

void
medianfilterimage(float $radius)

Applies a digital filter that improves the quality of a noisy image.

minifyimage()

Scales an image proportionally to half its size.

modulateimage(float $brightness, float $saturation, float $hue)

Controls the brightness, saturation, and hue.

motionblurimage(float $radius, float $sigma, float $angle)

Simulates motion blur.

newimage(int $width, int $height, string $background, string $format = null)

Creates a new image.

bool
nextimage()

Moves to the next image.

normalizeimage(int $channel = null)

Enhances the contrast of a color image.

oilpaintimage(float $radius)

Simulates an oil painting.

bool
previousimage()

Move to the previous image in the object.

profileimage(string $name, string $profile)

Adds or removes a profile from an image.

quantizeimage(int $numColors, int $colorspace, int $treeDepth, bool $dither, bool $measureError)

Analyzes the colors within a reference image.

quantizeimages(int $numColors, int $colorspace, int $treeDepth, bool $dither, bool $measureError)

The quantizeimages purpose.

array
queryfontmetrics(GmagickDraw $draw, string $text)

Returns an array representing the font metrics.

array
queryfonts(string $pattern = '*')

Returns fonts supported by Gmagick.

array
queryformats(string $pattern = '*')

Returns formats supported by Gmagick.

radialblurimage(float $angle, int $channel = Gmagick::CHANNEL_DEFAULT)

Radial blurs an image.

raiseimage(int $width, int $height, int $x, int $y, bool $raise)

Creates a simulated 3d button-like effect.

read(string $filename)

Reads image from filename.

readimage(string $filename)

Reads image from filename.

readimageblob(string $imageContents, string $filename = null)

Reads image from a binary string.

readimagefile(resource $fp, string $filename = null)

Reads an image or image sequence from an open file descriptor.

reducenoiseimage(float $radius)

Smooths the contours of an image.

removeimage()

Removes an image from the image list.

string
removeimageprofile(string $name)

Removes the named image profile and returns it.

resampleimage(float $xResolution, float $yResolution, int $filter, float $blur)

Resample image to desired resolution.

resizeimage(int $width, int $height, int $filter, float $blur, bool $fit = false)

Scales an image to the desired dimensions with a filter.

rollimage(int $x, int $y)

Offsets an image as defined by x and y.

rotateimage(mixed $color, float $degrees)

Rotates an image the specified number of degrees.

scaleimage(int $width, int $height, bool $fit = false)

Scales the size of an image to the given dimensions.

separateimagechannel(int $channel)

Separates a channel from the image and returns a grayscale image.

setCompressionQuality(int $quality = 75)

Sets the object's default compression quality.

setfilename(string $filename)

Sets the filename before you read or write the image.

setimagebackgroundcolor(GmagickPixel $color)

Sets the image background color.

setimageblueprimary(float $x, float $y)

Sets the image chromaticity blue primary point.

setimagebordercolor(GmagickPixel $color)

Sets the image border color.

setimagechanneldepth(int $channel, int $depth)

Sets the depth of a particular image channel.

setimagecolorspace(int $colorspace)

Sets the image colorspace.

setimagecompose(int $composite)

Sets the image composite operator.

setimagedelay(int $delay)

Sets the image delay.

setimagedepth(int $depth)

Sets the image depth.

setimagedispose(int $disposeType)

Sets the image disposal method.

setimagefilename(string $filename)

Sets the filename of a particular image in a sequence.

setimageformat(string $imageFormat)

Sets the format of a particular image in a sequence.

setimagegamma(float $gamma)

Sets the image gamma.

setimagegreenprimary(float $x, float $y)

Sets the image chromaticity green primary point.

setimageindex(int $index)

Sets the iterator to the position in the image list specified with the index parameter.

setimageinterlacescheme(int $interlace)

Sets the interlace scheme of the image.

setimageiterations(int $iterations)

Sets the image iterations.

setimageprofile(string $name, string $profile)

Adds a named profile to the Gmagick object.

setimageredprimary(float $x, float $y)

Sets the image chromaticity red primary point.

setimagerenderingintent(int $rendering_intent)

Sets the image rendering intent.

setimageresolution(float $xResolution, float $yResolution)

Sets the image resolution.

setimagescene(int $scene)

Sets the image scene.

setimagetype(int $imgType)

Sets the image type.

setimageunits(int $resolution)

Sets the image units of resolution.

setimagewhitepoint(float $x, float $y)

Sets the image chromaticity white point.

setsamplingfactors(array $factors)

Sets the image sampling factors.

setsize(int $columns, int $rows)

Sets the size of the Gmagick object.

shearimage(mixed $color, float $xShear, float $yShear)

Slides one edge of an image along the X or Y axis, creating a parallelogram.

solarizeimage(int $threshold)

Applies a solarizing effect to the image.

spreadimage(float $radius)

Randomly displaces each pixel in a block.

stripimage()

Strips an image of all profiles and comments.

swirlimage(float $degrees)

Swirls the pixels about the center of the image.

thumbnailimage(int $width, int $height, bool $fit = false)

Changes the size of an image to the given dimensions and removes any associated profiles.

trimimage(float $fuzz)

Remove edges that are the background color from the image.

write(string $filename)

Writes an image to the specified filename.

writeimage(string $filename, bool $all_frames = false)

Writes an image to the specified filename.

Details

__construct(string $filename = null)

The Gmagick constructor.

Parameters

string $filename

[optional] The path to an image to load or array of paths.

Gmagick addimage(Gmagick $Gmagick)

Adds new image to Gmagick object from the current position of the source object.

After the operation iterator position is moved at the end of the list.

Parameters

Gmagick $Gmagick

The source Gmagick object.

Return Value

Gmagick

The Gmagick object with image added.

Exceptions

GmagickException

Gmagick addnoiseimage(int $NOISE)

Adds random noise to the image.

Parameters

int $NOISE

The type of the noise. One of the Gmagick::NOISE_* constants.

Return Value

Gmagick

The Gmagick object with noise added.

Exceptions

GmagickException

Gmagick annotateimage(GmagickDraw $GmagickDraw, float $x, float $y, float $angle, string $text)

Annotates an image with text.

Parameters

GmagickDraw $GmagickDraw

The GmagickDraw object that contains settings for drawing the text.

float $x

Horizontal offset in pixels to the left of text.

float $y

Vertical offset in pixels to the baseline of text.

float $angle

The angle at which to write the text.

string $text

The string to draw.

Return Value

Gmagick

The Gmagick object with annotation made.

Exceptions

GmagickException

Gmagick blurimage(float $radius, float $sigma, int $channel = null)

Adds blur filter to image.

Parameters

float $radius

Blur radius.

float $sigma

Standard deviation

int $channel [optional]

Return Value

Gmagick

The blurred Gmagick object.

Exceptions

GmagickException

Gmagick borderimage(GmagickPixel $color, int $width, int $height)

Surrounds the image with a border of the color defined by the bordercolor GmagickPixel object or a color string.

Parameters

GmagickPixel $color

GmagickPixel object or a string containing the border color.

int $width

Border width.

int $height

Border height.

Return Value

Gmagick

The Gmagick object with border defined.

Exceptions

GmagickException

Gmagick charcoalimage(float $radius, float $sigma)

Simulates a charcoal drawing.

Parameters

float $radius

The radius of the Gaussian, in pixels, not counting the center pixel.

float $sigma

The standard deviation of the Gaussian, in pixels.

Return Value

Gmagick

The Gmagick object with charcoal simulation.

Exceptions

GmagickException

Gmagick chopimage(int $width, int $height, int $x, int $y)

Removes a region of an image and collapses the image to occupy the removed portion.

Parameters

int $width

Width of the chopped area.

int $height

Height of the chopped area.

int $x

X origo of the chopped area.

int $y

Y origo of the chopped area.

Return Value

Gmagick

The chopped Gmagick object.

Exceptions

GmagickException

Gmagick clear()

Clears all resources associated to Gmagick object.

Return Value

Gmagick

The cleared Gmagick object.

Exceptions

GmagickException

Gmagick commentimage(string $comment)

Adds a comment to your image.

Parameters

string $comment

The comment to add.

Return Value

Gmagick

The Gmagick object with comment added.

Exceptions

GmagickException

Gmagick compositeimage(Gmagick $source, int $COMPOSE, int $x, int $y)

Composite one image onto another at the specified offset.

Parameters

Gmagick $source

Gmagick object which holds the composite image.

int $COMPOSE

Composite operator.

int $x

The column offset of the composited image.

int $y

The row offset of the composited image.

Return Value

Gmagick

The Gmagick object with compositions.

Exceptions

GmagickException

Gmagick cropimage(int $width, int $height, int $x, int $y)

Extracts a region of the image.

Parameters

int $width

The width of the crop.

int $height

The height of the crop.

int $x

The X coordinate of the cropped region's top left corner.

int $y

The Y coordinate of the cropped region's top left corner.

Return Value

Gmagick

The cropped Gmagick object.

Exceptions

GmagickException

Gmagick cropthumbnailimage(int $width, int $height)

Creates a fixed size thumbnail by first scaling the image down and cropping a specified area from the center.

Parameters

int $width

The width of the thumbnail.

int $height

The Height of the thumbnail.

Return Value

Gmagick

The cropped Gmagick object.

Exceptions

GmagickException

Gmagick current()

Returns reference to the current gmagick object with image pointer at the correct sequence.

Return Value

Gmagick

Returns self on success.

Exceptions

GmagickException

Gmagick cyclecolormapimage(int $displace)

Displaces an image's colormap by a given number of positions.

If you cycle the colormap a number of times you can produce a psychedelic effect.

Parameters

int $displace

The amount to displace the colormap.

Return Value

Gmagick

Returns self on success.

Exceptions

GmagickException

Gmagick deconstructimages()

Compares each image with the next in a sequence.

Returns the maximum bounding region of any pixel differences it discovers.

Return Value

Gmagick

Returns a new Gmagick object on success.

Exceptions

GmagickException

Gmagick despeckleimage()

Reduces the speckle noise in an image while preserving the edges of the original image.

Return Value

Gmagick

The despeckled Gmagick object on success.

Exceptions

GmagickException

bool destroy()

Destroys the Gmagick object and frees all resources associated with it.

Return Value

bool

Returns TRUE on success.

Exceptions

GmagickException

Gmagick drawimage(GmagickDraw $GmagickDraw)

Renders the GmagickDraw object on the current image.

Parameters

GmagickDraw $GmagickDraw

The drawing operations to render on the image.

Return Value

Gmagick

The drawn Gmagick object.

Exceptions

GmagickException

Gmagick edgeimage(float $radius)

Enhance edges within the image with a convolution filter of the given radius.

Use radius 0 and it will be auto-selected.

Parameters

float $radius

The radius of the operation.

Return Value

Gmagick

The Gmagick object with edges enhanced.

Exceptions

GmagickException

Gmagick embossimage(float $radius, float $sigma)

Returns a grayscale image with a three-dimensional effect.

We convolve the image with a Gaussian operator of the given radius and standard deviation (sigma). For reasonable results, radius should be larger than sigma. Use a radius of 0 and it will choose a suitable radius for you.

Parameters

float $radius

The radius of the effect.

float $sigma

The sigma of the effect.

Return Value

Gmagick

The embossed Gmagick object.

Exceptions

GmagickException

Gmagick enhanceimage()

Applies a digital filter that improves the quality of a noisy image.

Return Value

Gmagick

The enhanced Gmagick object.

Exceptions

GmagickException

Gmagick equalizeimage()

Equalizes the image histogram.

Return Value

Gmagick

The equalized Gmagick object.

Exceptions

GmagickException

Gmagick flipimage()

Creates a vertical mirror image by reflecting the pixels around the central x-axis.

Return Value

Gmagick

The flipped Gmagick object.

Exceptions

GmagickException

Gmagick flopimage()

Creates a horizontal mirror image by reflecting the pixels around the central y-axis.

Return Value

Gmagick

The flopped Gmagick object.

Exceptions

GmagickException

Gmagick frameimage(GmagickPixel $color, int $width, int $height, int $inner_bevel, int $outer_bevel)

Adds a simulated three-dimensional border around the image.

The width and height specify the border width of the vertical and horizontal sides of the frame. The inner and outer bevels indicate the width of the inner and outer shadows of the frame.

Parameters

GmagickPixel $color

GmagickPixel object or a float representing the matte color.

int $width

The width of the border.

int $height

The height of the border.

int $inner_bevel

The inner bevel width.

int $outer_bevel

The outer bevel width.

Return Value

Gmagick

The framed Gmagick object.

Exceptions

GmagickException

Gmagick gammaimage(float $gamma)

Gamma-corrects an image.

The same image viewed on different devices will have perceptual differences in the way the image's intensities are represented on the screen. Specify individual gamma levels for the red, green, and blue channels, or adjust all three with the gamma parameter. Values typically range from 0.8 to 2.3.

Parameters

float $gamma

The amount of gamma-correction.

Return Value

Gmagick

The gamma corrected Gmagick object.

Exceptions

GmagickException

string getcopyright()

Returns the GraphicsMagick API copyright as a string.

Return Value

string

Returns a string containing the copyright notice of GraphicsMagick and Magickwand C API.

Exceptions

GmagickException

string getfilename()

Returns the filename associated with an image sequence.

Return Value

string

Returns a string on success.

Exceptions

GmagickException

GmagickPixel getimagebackgroundcolor()

Returns the image background color.

Return Value

GmagickPixel

Returns a GmagickPixel set to the background color of the image.

Exceptions

GmagickException

array getimageblueprimary()

Returns the chromaticity blue primary point for the image.

Return Value

array

Array consisting of "x" and "y" coordinates of point.

Exceptions

GmagickException

GmagickPixel getimagebordercolor()

Returns the image border color.

Return Value

GmagickPixel

GmagickPixel object representing the color of the border.

Exceptions

GmagickException

int getimagechanneldepth(int $channel_type)

Gets the depth for a particular image channel.

Parameters

int $channel_type

Return Value

int

Depth of image channel.

Exceptions

GmagickException

int getimagecolors()

Returns the color of the specified colormap index.

Return Value

int

The number of colors in image.

Exceptions

GmagickException

int getimagecolorspace()

Gets the image colorspace.

Return Value

int Colorspace

Exceptions

GmagickException

int getimagecompose()

Returns the composite operator associated with the image.

Return Value

int

Returns the composite operator associated with the image.

Exceptions

GmagickException

int getimagedelay()

Gets the image delay.

Return Value

int

Returns the composite operator associated with the image.

Exceptions

GmagickException

int getimagedepth()

Gets the depth of the image.

Return Value

int

Image depth.

Exceptions

GmagickException

int getimagedispose()

Gets the image disposal method.

Return Value

int

Returns the dispose method on success.

Exceptions

GmagickException

array getimageextrema()

Gets the extrema for the image.

Return Value

array

Returns an associative array with the keys "min" and "max".

Exceptions

GmagickException

string getimagefilename()

Returns the filename of a particular image in a sequence.

Return Value

string

Returns a string with the filename of the image

Exceptions

GmagickException

string getimageformat()

Returns the format of a particular image in a sequence.

Return Value

string

Returns a string containing the image format on success.

Exceptions

GmagickException

float getimagegamma()

Gets the image gamma.

Return Value

float

Returns the image gamma on success.

Exceptions

GmagickException

array getimagegreenprimary()

Returns the chromaticy green primary point.

Return Value

array

Returns an array with the keys "x" and "y" on success.

Exceptions

GmagickException

int getimageheight()

Returns the image height.

Return Value

int

Returns the image height in pixels.

Exceptions

GmagickException

array getimagehistogram()

Gets the image histogram.

Return Value

array

Returns the image histogram as an array of GmagickPixel objects.

Exceptions

GmagickException

int getimageindex()

Returns the index of the current active image within the Gmagick object.

Return Value

int

Index of current active image.

Exceptions

GmagickException

int getimageinterlacescheme()

Gets the image interlace scheme.

Return Value

int

Returns the interlace scheme as an integer on success.

Exceptions

GmagickException

int getimageiterations()

Gets the image iterations.

Return Value

int

Returns the image iterations as an integer.

Exceptions

GmagickException

bool getimagematte()

Checks if the image has a matte channel.

Return Value

bool

Returns TRUE if the image has a matte channel, otherwise FALSE.

Exceptions

GmagickException

GmagickPixel getimagemattecolor()

Returns the image matte color.

Return Value

GmagickPixel

Returns GmagickPixel object on success.

Exceptions

GmagickException

string getimageprofile(string $name)

Returns the named image profile.

Parameters

string $name

Return Value

string

Returns a string containing the image profile.

Exceptions

GmagickException

array getimageredprimary()

Returns the chromaticity red primary point.

Return Value

array

Returns the chromaticity red primary point as an array with the keys "x" and "y".

Exceptions

GmagickException

int getimagerenderingintent()

Gets the image rendering intent.

Return Value

int

Extracts a region of the image and returns it as a a new wand.

Exceptions

GmagickException

array getimageresolution()

Gets the image X and Y resolution.

Return Value

array

Returns the resolution as an array.

Exceptions

GmagickException

int getimagescene()

Gets the image scene.

Return Value

int

Returns the image scene.

Exceptions

GmagickException

string getimagesignature()

Generates an SHA-256 message digest for the image pixel stream.

Return Value

string

Returns a string containing the SHA-256 hash of the file.

Exceptions

GmagickException

int getimagetype()

Gets the potential image type.

Return Value

int

Returns the potential image type.

Exceptions

GmagickException

int getimageunits()

Gets the image units of resolution.

Return Value

int

Returns the image units of resolution.

array getimagewhitepoint()

Returns the chromaticity white point.

Return Value

array

Returns the chromaticity white point as an associative array with the keys "x" and "y".

Exceptions

GmagickException

int getimagewidth()

Returns the width of the image.

Return Value

int

Returns the image width.

Exceptions

GmagickException

string getpackagename()

Returns the GraphicsMagick package name.

Return Value

string

Returns the GraphicsMagick package name as a string.

Exceptions

GmagickException

array getquantumdepth()

Returns the Gmagick quantum depth.

Return Value

array

Returns the Gmagick quantum depth.

Exceptions

GmagickException

string getreleasedate()

Returns the GraphicsMagick release date as a string.

Return Value

string

Returns the GraphicsMagick release date as a string.

Exceptions

GmagickException

array getsamplingfactors()

Gets the horizontal and vertical sampling factor.

Return Value

array

Returns an associative array with the horizontal and vertical sampling factors of the image.

Exceptions

GmagickException

array getsize()

Returns the size associated with the Gmagick object.

Return Value

array

Returns the size associated with the Gmagick object as an array with the keys "columns" and "rows".

Exceptions

GmagickException

array getversion()

Returns the GraphicsMagick API version.

Return Value

array

Returns the GraphicsMagick API version as a string and as a number.

Exceptions

GmagickException

bool hasnextimage()

Checks if the object has more images.

Return Value

bool

Returns TRUE if the object has more images when traversing the list in the forward direction, returns FALSE if there are none.

Exceptions

GmagickException

bool haspreviousimage()

Checks if the object has a previous image.

Return Value

bool

Returns TRUE if the object has more images when traversing the list in the reverse direction, returns FALSE if there are none.

Exceptions

GmagickException

mixed implodeimage(float $radius)

Creates a new image that is a copy of an existing one with the image pixels "imploded" by the specified percentage.

Parameters

float $radius

The radius of the implode.

Return Value

mixed

Returns imploded Gmagick object.

Exceptions

GmagickException

mixed labelimage(string $label)

Adds a label to an image.

Parameters

string $label

The label to add.

Return Value

mixed

Gmagick with label.

Exceptions

GmagickException

mixed levelimage(float $blackPoint, float $gamma, float $whitePoint, int $channel = false)

Adjusts the levels of an image.

Adjusts the levels of an image by scaling the colors falling between specified white and black points to the full available quantum range. The parameters provided represent the black, mid, and white points. The black point specifies the darkest color in the image. Colors darker than the black point are set to zero. Mid point specifies a gamma correction to apply to the image. White point specifies the lightest color in the image. Colors brighter than the white point are set to the maximum quantum value.

Parameters

float $blackPoint

The image black point.

float $gamma

The gamma value.

float $whitePoint

The image white point.

int $channel

Provide any channel constant that is valid for your channel mode. To apply to more than one channel, combine channeltype constants using bitwise operators. Refer to this list of channel constants.

Return Value

mixed

Gmagick object with image levelled.

Exceptions

GmagickException

mixed magnifyimage()

Scales an image proportionally 2x.

Return Value

mixed

Magnified Gmagick object.

Exceptions

GmagickException

Gmagick mapimage(gmagick $gmagick, bool $dither)

Replaces the colors of an image with the closest color from a reference image.

Parameters

gmagick $gmagick

The reference image.

bool $dither

Set this integer value to something other than zero to dither the mapped image.

Return Value

Gmagick

Gmagick object.

Exceptions

GmagickException

void medianfilterimage(float $radius)

Applies a digital filter that improves the quality of a noisy image.

Each pixel is replaced by the median in a set of neighboring pixels as defined by radius.

Parameters

float $radius

The radius of the pixel neighborhood.

Return Value

void

Gmagick object with median filter applied.

Exceptions

GmagickException

Gmagick minifyimage()

Scales an image proportionally to half its size.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick modulateimage(float $brightness, float $saturation, float $hue)

Controls the brightness, saturation, and hue.

Parameters

float $brightness

The percent change in brightness (-100 thru +100).

float $saturation

The percent change in saturation (-100 thru +100).

float $hue

The percent change in hue (-100 thru +100).

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick motionblurimage(float $radius, float $sigma, float $angle)

Simulates motion blur.

We convolve the image with a Gaussian operator of the given radius and standard deviation (sigma). For reasonable results, radius should be larger than sigma. Use a radius of 0 and MotionBlurImage() selects a suitable radius for you. Angle gives the angle of the blurring motion.

Parameters

float $radius

The radius of the Gaussian, in pixels, not counting the center pixel.

float $sigma

The standard deviation of the Gaussian, in pixels.

float $angle

Apply the effect along this angle.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick newimage(int $width, int $height, string $background, string $format = null)

Creates a new image.

Parameters

int $width

Width of the new image

int $height

Height of the new image.

string $background

The background color used for this image.

string $format

[optional] Image format.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

bool nextimage()

Moves to the next image.

Associates the next image in the image list with an Gmagick object.

Return Value

bool

True on success, false on failure.

Gmagick normalizeimage(int $channel = null)

Enhances the contrast of a color image.

Parameters

int $channel

[optional] Identify which channel to normalize.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick oilpaintimage(float $radius)

Simulates an oil painting.

Applies a special effect filter that simulates an oil painting. Each pixel is replaced by the most frequent color occurring in a circular region defined by radius.

Parameters

float $radius

The radius of the circular neighborhood.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

bool previousimage()

Move to the previous image in the object.

Associates the previous image in an image list with the Gmagick object.

Return Value

bool

True on success, false on failure.

Exceptions

GmagickException

Gmagick profileimage(string $name, string $profile)

Adds or removes a profile from an image.

Adds or removes a ICC, IPTC, or generic profile from an image. If the profile is NULL, it is removed from the image otherwise added. Use a name of '*' and a profile of NULL to remove all profiles from the image.

Parameters

string $name

Name of profile to add or remove: ICC, IPTC, or generic profile.

string $profile

The profile.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick quantizeimage(int $numColors, int $colorspace, int $treeDepth, bool $dither, bool $measureError)

Analyzes the colors within a reference image.

Analyzes the colors within a reference image and chooses a fixed number of colors to represent the image. The goal of the algorithm is to minimize the color difference between the input and output image while minimizing the processing time.

Parameters

int $numColors

The number of colors.

int $colorspace

Perform color reduction in this colorspace, typically RGBColorspace.

int $treeDepth

Normally, this integer value is zero or one. A zero or one tells Quantize to choose a optimal tree depth of Log4(number_colors). A tree of this depth generally allows the best representation of the reference image with the least amount of memory and the fastest computational speed. In some cases, such as an image with low color dispersion (a few number of colors), a value other than Log4(number_colors) is required. To expand the color tree completely, use a value of 8.

bool $dither

A value other than zero distributes the difference between an original image and the corresponding color reduced algorithm to neighboring pixels along a Hilbert curve.

bool $measureError

A value other than zero measures the difference between the original and quantized images. This difference is the total quantization error. The error is computed by summing over all pixels in an image the distance squared in RGB space between each reference pixel value and its quantized value.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick quantizeimages(int $numColors, int $colorspace, int $treeDepth, bool $dither, bool $measureError)

The quantizeimages purpose.

Analyzes the colors within a sequence of images and chooses a fixed number of colors to represent the image. The goal of the algorithm is to minimize the color difference between the input and output image while minimizing the processing time.

Parameters

int $numColors

The number of colors.

int $colorspace

Perform color reduction in this colorspace, typically RGBColorspace.

int $treeDepth

Normally, this integer value is zero or one. A zero or one tells Quantize to choose a optimal tree depth of Log4(number_colors). A tree of this depth generally allows the best representation of the reference image with the least amount of memory and the fastest computational speed. In some cases, such as an image with low color dispersion (a few number of colors), a value other than Log4(number_colors) is required. To expand the color tree completely, use a value of 8.

bool $dither

A value other than zero distributes the difference between an original image and the corresponding color reduced algorithm to neighboring pixels along a Hilbert curve.

bool $measureError

A value other than zero measures the difference between the original and quantized images. This difference is the total quantization error. The error is computed by summing over all pixels in an image the distance squared in RGB space between eac reference pixel value and its quantized value.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

array queryfontmetrics(GmagickDraw $draw, string $text)

Returns an array representing the font metrics.

Parameters

GmagickDraw $draw
string $text

Return Value

array

Exceptions

GmagickException

array queryfonts(string $pattern = '*')

Returns fonts supported by Gmagick.

Parameters

string $pattern [optional]

Return Value

array

Exceptions

GmagickException

array queryformats(string $pattern = '*')

Returns formats supported by Gmagick.

Parameters

string $pattern [optional]

Return Value

array

Exceptions

GmagickException

Gmagick radialblurimage(float $angle, int $channel = Gmagick::CHANNEL_DEFAULT)

Radial blurs an image.

Parameters

float $angle

The angle of the blur in degrees.

int $channel

[optional] Related channel.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick raiseimage(int $width, int $height, int $x, int $y, bool $raise)

Creates a simulated 3d button-like effect.

Creates a simulated three-dimensional button-like effect by lightening and darkening the edges of the image. Members width and height of raise_info define the width of the vertical and horizontal edge of the effect.

Parameters

int $width

Width of the area to raise.

int $height

Height of the area to raise.

int $x

X coordinate.

int $y

Y coordinate.

bool $raise

A value other than zero creates a 3-D raise effect, otherwise it has a lowered effect.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick read(string $filename)

Reads image from filename.

This is an alias for readimage().

Parameters

string $filename

The image filename.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick readimage(string $filename)

Reads image from filename.

Parameters

string $filename

The image filename.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick readimageblob(string $imageContents, string $filename = null)

Reads image from a binary string.

Parameters

string $imageContents

Content of image.

string $filename

[optional] The image filename.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick readimagefile(resource $fp, string $filename = null)

Reads an image or image sequence from an open file descriptor.

Parameters

resource $fp

The file descriptor.

string $filename [optional]

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick reducenoiseimage(float $radius)

Smooths the contours of an image.

Smooths the contours of an image while still preserving edge information. The algorithm works by replacing each pixel with its neighbor closest in value. A neighbor is defined by radius. Use a radius of 0 and Gmagick::reduceNoiseImage() selects a suitable radius for you.

Parameters

float $radius

The radius of the pixel neighborhood.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick removeimage()

Removes an image from the image list.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

string removeimageprofile(string $name)

Removes the named image profile and returns it.

Parameters

string $name

Name of profile to return: ICC, IPTC, or generic profile.

Return Value

string

The named profile.

Exceptions

GmagickException

Gmagick resampleimage(float $xResolution, float $yResolution, int $filter, float $blur)

Resample image to desired resolution.

Parameters

float $xResolution

The new image x resolution.

float $yResolution

The new image y resolution.

int $filter

The image filter to use.

float $blur

The blur factor where larger than 1 is blurry, smaller than 1 is sharp.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick resizeimage(int $width, int $height, int $filter, float $blur, bool $fit = false)

Scales an image to the desired dimensions with a filter.

Parameters

int $width

The number of columns in the scaled image.

int $height

The number of rows in the scaled image.

int $filter

Image filter to use.

float $blur

The blur factor where larger than 1 is blurry, lesser than 1 is sharp.

bool $fit [optional]

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick rollimage(int $x, int $y)

Offsets an image as defined by x and y.

Parameters

int $x

The x offset.

int $y

The y offset.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick rotateimage(mixed $color, float $degrees)

Rotates an image the specified number of degrees.

Empty triangles left over from rotating the image are filled with the background color.

Parameters

mixed $color

The background pixel.

float $degrees

The number of degrees to rotate the image.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick scaleimage(int $width, int $height, bool $fit = false)

Scales the size of an image to the given dimensions.

The other parameter will be calculated if 0 is passed as either param.

Parameters

int $width

The number of columns in the scaled image.

int $height

The number of rows in the scaled image.

bool $fit [optional]

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick separateimagechannel(int $channel)

Separates a channel from the image and returns a grayscale image.

A channel is a particular color component of each pixel in the image.

Parameters

int $channel

Identify which channel to extract: RedChannel, GreenChannel, BlueChannel, OpacityChannel, CyanChannel, MagentaChannel, YellowChannel, BlackChannel.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick setCompressionQuality(int $quality = 75)

Sets the object's default compression quality.

Parameters

int $quality [optional]

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick setfilename(string $filename)

Sets the filename before you read or write the image.

Parameters

string $filename

The image filename.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick setimagebackgroundcolor(GmagickPixel $color)

Sets the image background color.

Parameters

GmagickPixel $color

The background pixel wand.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick setimageblueprimary(float $x, float $y)

Sets the image chromaticity blue primary point.

Parameters

float $x

The blue primary x-point.

float $y

The blue primary y-point.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick setimagebordercolor(GmagickPixel $color)

Sets the image border color.

Parameters

GmagickPixel $color

The border pixel wand.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick setimagechanneldepth(int $channel, int $depth)

Sets the depth of a particular image channel.

Parameters

int $channel

Identify which channel to extract: RedChannel, GreenChannel, BlueChannel, OpacityChannel, CyanChannel, MagentaChannel, YellowChannel, BlackChannel.

int $depth

The image depth in bits.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick setimagecolorspace(int $colorspace)

Sets the image colorspace.

Parameters

int $colorspace

The image colorspace: UndefinedColorspace, RGBColorspace, GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace, YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace, YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace, HSLColorspace, or HWBColorspace.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick setimagecompose(int $composite)

Sets the image composite operator.

Parameters

int $composite

The image composite operator.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick setimagedelay(int $delay)

Sets the image delay.

Parameters

int $delay

The image delay in 1/100th of a second.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick setimagedepth(int $depth)

Sets the image depth.

Parameters

int $depth

The image depth in bits: 8, 16, or 32.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick setimagedispose(int $disposeType)

Sets the image disposal method.

Parameters

int $disposeType

The image disposal type.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick setimagefilename(string $filename)

Sets the filename of a particular image in a sequence.

Parameters

string $filename

The image filename.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick setimageformat(string $imageFormat)

Sets the format of a particular image in a sequence.

Parameters

string $imageFormat

The image format.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick setimagegamma(float $gamma)

Sets the image gamma.

Parameters

float $gamma

The image gamma.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick setimagegreenprimary(float $x, float $y)

Sets the image chromaticity green primary point.

Parameters

float $x

The chromaticity green primary x-point.

float $y

The chromaticity green primary y-point.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick setimageindex(int $index)

Sets the iterator to the position in the image list specified with the index parameter.

Parameters

int $index

The scene number.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick setimageinterlacescheme(int $interlace)

Sets the interlace scheme of the image.

Parameters

int $interlace

The image interlace scheme: NoInterlace, LineInterlace, PlaneInterlace, PartitionInterlace.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick setimageiterations(int $iterations)

Sets the image iterations.

Parameters

int $iterations

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick setimageprofile(string $name, string $profile)

Adds a named profile to the Gmagick object.

If a profile with the same name already exists, it is replaced. This method differs from the Gmagick::profileimage() method in that it does not apply any CMS color profiles.

Parameters

string $name

Name of profile to add or remove: ICC, IPTC, or generic profile.

string $profile

The profile.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick setimageredprimary(float $x, float $y)

Sets the image chromaticity red primary point.

Parameters

float $x

The red primary x-point.

float $y

The red primary y-point.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick setimagerenderingintent(int $rendering_intent)

Sets the image rendering intent.

Parameters

int $rendering_intent

The image rendering intent: UndefinedIntent, SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick setimageresolution(float $xResolution, float $yResolution)

Sets the image resolution.

Parameters

float $xResolution

The image x resolution.

float $yResolution

The image y resolution.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick setimagescene(int $scene)

Sets the image scene.

Parameters

int $scene

The image scene number.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick setimagetype(int $imgType)

Sets the image type.

Parameters

int $imgType

The image type: UndefinedType, BilevelType, GrayscaleType, GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType, TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType, or OptimizeType.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick setimageunits(int $resolution)

Sets the image units of resolution.

Parameters

int $resolution

The image units of resolution : Undefinedresolution, PixelsPerInchResolution, or PixelsPerCentimeterResolution.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick setimagewhitepoint(float $x, float $y)

Sets the image chromaticity white point.

Parameters

float $x

The white x-point.

float $y

The white y-point.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick setsamplingfactors(array $factors)

Sets the image sampling factors.

Parameters

array $factors

An array of doubles representing the sampling factor for each color component (in RGB order).

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick setsize(int $columns, int $rows)

Sets the size of the Gmagick object.

Set it before you read a raw image format such as RGB, GRAY, or CMYK.

Parameters

int $columns

The width in pixels.

int $rows

The height in pixels.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick shearimage(mixed $color, float $xShear, float $yShear)

Slides one edge of an image along the X or Y axis, creating a parallelogram.

An X direction shear slides an edge along the X axis, while a Y direction shear slides an edge along the Y axis. The amount of the shear is controlled by a shear angle. For X direction shears, x_shear is measured relative to the Y axis, and similarly, for Y direction shears y_shear is measured relative to the X axis. Empty triangles left over from shearing the image are filled with the background color.

Parameters

mixed $color

The background pixel wand.

float $xShear

The number of degrees to shear the image.

float $yShear

The number of degrees to shear the image.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick solarizeimage(int $threshold)

Applies a solarizing effect to the image.

Applies a special effect to the image, similar to the effect achieved in a photo darkroom by selectively exposing areas of photo sensitive paper to light. Threshold ranges from 0 to QuantumRange and is a measure of the extent of the solarization.

Parameters

int $threshold

Define the extent of the solarization.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick spreadimage(float $radius)

Randomly displaces each pixel in a block.

Special effects method that randomly displaces each pixel in a block defined by the radius parameter.

Parameters

float $radius

Choose a random pixel in a neighborhood of this extent.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick stripimage()

Strips an image of all profiles and comments.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick swirlimage(float $degrees)

Swirls the pixels about the center of the image.

Swirls the pixels about the center of the image, where degrees indicates the sweep of the arc through which each pixel is moved. You get a more dramatic effect as the degrees move from 1 to 360.

Parameters

float $degrees

Define the tightness of the swirling effect.

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick thumbnailimage(int $width, int $height, bool $fit = false)

Changes the size of an image to the given dimensions and removes any associated profiles.

The goal is to produce small low cost thumbnail images suited for display on the Web. If TRUE is given as a third parameter then columns and rows parameters are used as maximums for each side. Both sides will be scaled down until the match or are smaller than the parameter given for the side.

Parameters

int $width

Image width.

int $height

Image height.

bool $fit [optional]

Return Value

Gmagick

The Gmagick object on success.

Exceptions

GmagickException

Gmagick trimimage(float $fuzz)

Remove edges that are the background color from the image.

Parameters

float $fuzz

By default target must match a particular pixel color exactly. However, in many cases two colors may differ by a small amount. The fuzz member of image defines how much tolerance is acceptable to consider two colors as the same. This parameter represents the variation on the quantum range.

Return Value

Gmagick

The Gmagick object.

Exceptions

GmagickException

Gmagick write(string $filename)

Writes an image to the specified filename.

Writes an image to the specified filename. If the filename parameter is NULL, the image is written to the filename set by Gmagick::ReadImage() or Gmagick::SetImageFilename().

This is an alias for writeimage().

Parameters

string $filename

The image filename.

Return Value

Gmagick

The Gmagick object.

Exceptions

GmagickException

Gmagick writeimage(string $filename, bool $all_frames = false)

Writes an image to the specified filename.

Writes an image to the specified filename. If the filename parameter is NULL, the image is written to the filename set by Gmagick::ReadImage() or Gmagick::SetImageFilename().

Parameters

string $filename

The image filename.

bool $all_frames [optional]

Return Value

Gmagick

The Gmagick object.

Exceptions

GmagickException