Delicious Bookmark this on Delicious Share on Facebook SlashdotSlashdot It! Digg! Digg



PHP : Function Reference : Imagick Image Library

Imagick Image Library

Introduction

Warning:

This extension is EXPERIMENTAL. The behaviour of this extension -- including the names of its functions and anything else documented about this extension -- may change without notice in a future release of PHP. Use this extension at your own risk.

Imagick is a native php extension to create and modify images using the ImageMagick API.

ImageMagick® is a software suite to create, edit, and compose bitmap images.. It can read, convert and write images in a variety of formats (over 100) including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript, SVG, and TIFF.

Copyright 1999-2007 ImageMagick Studio LLC, a non-profit organization dedicated to making software imaging solutions freely available.

Examples

Imagick makes image manipulation in PHP extremely easy through an OO interface. Here is a quick example on how to make a thumbnail:

Example 1028. Creating a thumbnail in Imagick

<?php

header
('Content-type: image/jpeg');

$image = new Imagick('image.jpg');

// If 0 is provided as a width or height parameter,
// aspect ratio is maintained
$image->thumbnailImage(100, 0);

echo
$image;

?>


Using SPL and other OO features supported in Imagick, it can be simple to resize all files in a directory (useful for batch resizing large digital camera images to be web viewable). Here we use resize, as we might want to retain certain meta-data:

Example 1029. Make a thumbnail of all JPG files in a directory

<?php

$images
= new Imagick(glob('images/*.JPG'));

foreach(
$images as $image) {

   
// Providing 0 forces thumbnailImage to maintain aspect ratio
   
$image->thumbnailImage(1024,0);

}

$images->writeImages();

?>


Table of Contents

Constants — Imagick class constants
Installation — Installing the Imagick extension
Imagick — Imagick Class
Imagick::adaptiveBlurImage — Adds adaptive blur filter to image
Imagick::adaptiveResizeImage — Adaptively resize image with data dependent triangulation
Imagick::adaptiveSharpenImage — Adaptively sharpen the image
Imagick::adaptiveThresholdImage — Selects a threshold for each pixel based on a range of intensity
Imagick::addImage — Adds new image to Imagick object image list
Imagick::addNoiseImage — Adds random noise to the image
Imagick::affineTransformImage — Transforms an image
Imagick::annotateImage — Annotates an image with text
Imagick::appendImages — Append a set of images
Imagick::averageImages — Average a set of images
Imagick::blackThresholdImage — Forces all pixels below the threshold into black
Imagick::blurImage — Adds blur filter to image
Imagick::borderImage — Surrounds the image with a border
Imagick::charcoalImage — Simulates a charcoal drawing
Imagick::chopImage — Removes a region of an image and trims
Imagick::clear — Clears all resources associated to Imagick object
Imagick::clipImage — Clips along the first path from the 8BIM profile
Imagick::clipPathImage — Clips along the named paths from the 8BIM profile
Imagick::clone — Makes an exact copy of the Imagick object
Imagick::coalesceImages — Composites a set of images
Imagick::colorFloodfillImage — Changes the color value of any pixel that matches target
Imagick::colorizeImage — Blends the fill color with the image
Imagick::clutImage — Replaces colors in the image from a color lookup table
Imagick::combineImages — Combines one or more images into a single image
Imagick::commentImage — Adds a comment to your image
Imagick::compareImageChannels — Returns the difference in one or more images
Imagick::compareImageLayers — Returns the maximum bounding region between images
Imagick::compositeImage — Composite one image onto another
Imagick::__construct — The Imagick constructor
Imagick::contrastImage — Change the contrast of the image
Imagick::contrastStretchImage — Enhances the contrast of a color image
Imagick::convolveImage — Applies a custom convolution kernel to the image
Imagick::cropImage — Extracts a region of the image
Imagick::current — Sets image pointer at the correct sequence
Imagick::cycleColormapImage — Displaces an image's colormap
Imagick::deconstructImages — Returns certain pixel differences between images
Imagick::despeckleImage — Reduces the speckle noise in an image
Imagick::destroy — Destroys the Imagick object
Imagick::drawImage — Renders the ImagickDrawing object on the current image
Imagick::edgeImage — Enhance edges within the image
Imagick::embossImage — Returns a grayscale image with a three-dimensional effect
Imagick::enhanceImage — Improves the quality of a noisy image
Imagick::equalizeImage — Equalizes the image histogram
Imagick::evaluateImage — Applies an expression to an image
Imagick::flattenImages — Merges a sequence of images
Imagick::flipImage — Creates a vertical mirror image
Imagick::flopImage — Creates a horizontal mirror image
Imagick::frameImage — Adds a simulated three-dimensional border
Imagick::fxImage — Evaluate expression for each pixel in the image
Imagick::gammaImage — Gamma-corrects an image
Imagick::gaussianBlurImage — Blurs an image
Imagick::getCompressionQuality — Gets the object compression quality
Imagick::getCompression — Gets the object compression type
Imagick::getCopyright — Returns the ImageMagick API copyright as a string constant
Imagick::getFilename — The filename associated with an image sequence
Imagick::getFormat — Returns the format of the Imagick object
Imagick::getHomeURL — Returns the ImageMagick home URL
Imagick::getImageBackgroundColor — Returns the image background color
Imagick::getImageBlob — Returns the image sequence as a blob
Imagick::getImageBluePrimary — Returns the chromaticy blue primary point
Imagick::getImageBorderColor — Returns the image border color
Imagick::getImageChannelDepth — Gets the depth for a particular image channel
Imagick::getImageChannelDistortion — Compares image channels of an image to a reconstructed image
Imagick::getImageChannelExtrema — Gets the extrema for one or more image channels
Imagick::getImageChannelMean — Gets the mean and standard deviation
Imagick::getImageChannelStatistics — Returns statistics for each channel in the image
Imagick::getImageColormapColor — Returns the color of the specified colormap index
Imagick::getImageColorspace — Gets the image colorspace
Imagick::getImageColors — Gets the number of unique colors in the image
Imagick::getImageCompose — Returns the composite operator associated with the image
Imagick::getImageDelay — Gets the image delay
Imagick::getImageDepth — Gets the image depth
Imagick::getImageDispose — Gets the image disposal method
Imagick::getImageDistortion — Compares an image to a reconstructed image
Imagick::getImageExtrema — Gets the extrema for the image
Imagick::getImageFilename — Returns the filename of a particular image in a sequence
Imagick::getImageSize — Returns the image length in bytes
Imagick::getImageLength — Returns the image length in bytes
Imagick::getImageFormat — Returns the format of a particular image in a sequence
Imagick::getImageGamma — Gets the image gamma
Imagick::getImageGeometry — Gets the width and height as an associative array
Imagick::getImageGreenPrimary — Returns the chromaticy green primary point
Imagick::getImageHeight — Returns the image height
Imagick::getImageHistogram — Gets the image histogram
Imagick::getImageIndex — Gets the index of the current active image
Imagick::getIteratorIndex — Gets the index of the current active image
Imagick::getImageInterlaceScheme — Gets the image interlace scheme
Imagick::getImageInterpolateMethod — Returns the interpolation method
Imagick::getImageIterations — Gets the image iterations
Imagick::getImageMatteColor — Returns the image matte color
Imagick::getImageMatte — Return if the image has a matte channel
Imagick::getImagePage — Returns the page geometry
Imagick::getImagePixelColor — Returns the color of the specified pixel
Imagick::getImageProfile — Returns the named image profile
Imagick::getImageProfiles — Returns the image profiles
Imagick::getImageProperty — Returns the named image property
Imagick::getImageProperties — Returns the image properties
Imagick::getImageRedPrimary — Returns the chromaticy red primary point
Imagick::getImageRegion — Extracts a region of the image
Imagick::getImageRenderingIntent — Gets the image rendering intent
Imagick::getImageResolution — Gets the image X and Y resolution
Imagick::getImageScene — Gets the image scene
Imagick::getImageSignature — Generates an SHA-256 message digest
Imagick::getImageTicksPerSecond — Gets the image ticks-per-second
Imagick::getImageTotalInkDensity — Gets the image total ink density
Imagick::getImageType — Gets the potential image type
Imagick::getImageUnits — Gets the image units of resolution
Imagick::getImageVirtualPixelMethod — Returns the virtual pixel method
Imagick::getImageWhitePoint — Returns the chromaticy white point
Imagick::getImageWidth — Returns the image width
Imagick::getImage — Returns a new Imagick object
Imagick::getInterlaceScheme — Gets the object interlace scheme
Imagick::getImageOrientation — Gets the image orientation.
Imagick::getNumberImages — Returns the number of images in the object
Imagick::getOption — Returns a value associated with the specified key
Imagick::getPackageName — Returns the ImageMagick package name
Imagick::getPage — Returns the page geometry
Imagick::getPixelIterator — Returns a MagickPixelIterator
Imagick::getPixelRegionIterator — Get an ImagickPixelIterator for an image section
Imagick::getQuantumDepth — Gets the quantum depth
Imagick::getQuantumRange — Returns the Imagick quantum range
Imagick::getReleaseDate — Returns the ImageMagick release date
Imagick::getResourceLimit — Returns the specified resource limit
Imagick::getResource — Returns the specified resource's memory usage
Imagick::getSamplingFactors — Gets the horizontal and vertical sampling factor
Imagick::getSizeOffset — Returns the size offset
Imagick::getSize — Returns the size associated with the Imagick object
Imagick::getVersion — Returns the ImageMagick API version
Imagick::hasNextImage — Checks if the object has more images
Imagick::hasPreviousImage — Checks if the object has a previous image
Imagick::identifyImage — Identifies an image and fetches attributes
Imagick::implodeImage — Creates a new image as a copy
Imagick::labelImage — Adds a label to an image
Imagick::levelImage — Adjusts the levels of an image
Imagick::linearStretchImage — Stretches with saturation the image intensity
Imagick::magnifyImage — Scales an image proportionally 2x
Imagick::matteFloodfillImage — Changes the transparency value of a color
Imagick::medianFilterImage — Applies a digital filter
Imagick::minifyImage — Scales an image proportionally to half its size
Imagick::modulateImage — Control the brightness, saturation, and hue
Imagick::montageImage — Creates a composite image
Imagick::morphImages — Method morphs a set of images
Imagick::compareImages — Compares an image to a reconstructed image
Imagick::mosaicImages — Forms a mosaic from images
Imagick::motionBlurImage — Simulates motion blur
Imagick::negateImage — Negates the colors in the reference image
Imagick::distortImage — Distorts an image using various distortion methods
Imagick::newImage — Creates a new image
Imagick::setImage — Replaces image in the object
Imagick::setImageOpacity — Sets the image opacity level
Imagick::newPseudoImage — Creates a new image
Imagick::nextImage — Moves to the next image
Imagick::normalizeImage — Enhances the contrast of a color image
Imagick::oilPaintImage — Simulates an oil painting
Imagick::optimizeImageLayers — Removes repeated portions of images to optimize
Imagick::paintOpaqueImage — Change any pixel that matches color
Imagick::paintTransparentImage — Changes any pixel that matches color with the color defined by fill
Imagick::pingImageBlob — Quickly fetch attributes
Imagick::pingImageFile — Get basic image attributes in a lightweight manner
Imagick::pingImage — Fetch basic attributes about the image
Imagick::posterizeImage — Reduces the image to a limited number of color level
Imagick::previousImage — Move to the previous image in the object
Imagick::profileImage — Adds or removes a profile from an image
Imagick::queryFormats — Returns formats supported by Imagick
Imagick::radialBlurImage — Radial blurs an image
Imagick::raiseImage — Creates a simulated 3d button-like effect
Imagick::randomThresholdImage — Creates a high-contrast, two-color image
Imagick::readImageBlob — Reads image from a binary string
Imagick::readImageFile — Reads image from open filehandle
Imagick::readImage — Reads image from filename
Imagick::reduceNoiseImage — Smooths the contours of an image
Imagick::removeImageProfile — Removes the named image profile and returns it
Imagick::removeImage — Removes an image from the image list
Imagick::render — Renders all preceding drawing commands
Imagick::resampleImage — Resample image to desired resolution
Imagick::resizeImage — Scales an image
Imagick::rollImage — Offsets an image
Imagick::rotateImage — Rotates an image
Imagick::sampleImage — Scales an image with pixel sampling
Imagick::scaleImage — Scales the size of an image
Imagick::separateImageChannel — Separates a channel from the image
Imagick::sepiaToneImage — Sepia tones an image
Imagick::setBackgroundColor — Sets the object's default background color
Imagick::setCompressionQuality — Sets the object's default compression quality
Imagick::setCompression — Sets the object's default compression type
Imagick::setFilename — Sets the filename before you read or write the image
Imagick::setFirstIterator — Sets the Imagick iterator to the first image
Imagick::setLastIterator — Sets the Imagick iterator to the last image
Imagick::setFormat — Sets the format of the Imagick object
Imagick::setImageBackgroundColor — Sets the image background color
Imagick::setImageBias — Sets the image bias for any method that convolves an image
Imagick::setImageBluePrimary — Sets the image chromaticity blue primary point
Imagick::setImageBorderColor — Sets the image border color
Imagick::setImageChannelDepth — Sets the depth of a particular image channel
Imagick::setImageColormapColor — Sets the color of the specified colormap index
Imagick::setImageColorspace — Sets the image colorspace
Imagick::setImageCompose — Sets the image composite operator
Imagick::setImageCompression — Sets the image compression
Imagick::setImageDelay — Sets the image delay
Imagick::setImageDepth — Sets the image depth
Imagick::setImageDispose — Sets the image disposal method
Imagick::setImageExtent — Sets the image size
Imagick::setImageFilename — Sets the filename of a particular image
Imagick::setImageFormat — Sets the format of a particular image
Imagick::setImageGamma — Sets the image gamma
Imagick::setImageGreenPrimary — Sets the image chromaticity green primary point
Imagick::setImageIndex — Set the iterator position
Imagick::setIteratorIndex — Set the iterator position
Imagick::setImageInterlaceScheme — Sets the image compression
Imagick::setImageInterpolateMethod — Sets the image interpolate pixel method
Imagick::setImageIterations — Sets the image iterations
Imagick::setImageMatteColor — Sets the image matte color
Imagick::setImageMatte — Sets the image matte channel
Imagick::setImagePage — Sets the page geometry of the image
Imagick::setImageProfile — Adds a named profile to the Imagick object
Imagick::setImageProperty — Sets an image property
Imagick::setImageRedPrimary — Sets the image chromaticity red primary point
Imagick::setImageRenderingIntent — Sets the image rendering intent
Imagick::setImageResolution — Sets the image resolution
Imagick::setImageScene — Sets the image scene
Imagick::setImageTicksPerSecond — Sets the image ticks-per-second
Imagick::setImageType — Sets the image type
Imagick::setImageUnits — Sets the image units of resolution
Imagick::setImageVirtualPixelMethod — Sets the image virtual pixel method
Imagick::setImageWhitePoint — Sets the image chromaticity white point
Imagick::setInterlaceScheme — Sets the image compression
Imagick::setImageOrientation — Sets the image orientation.
Imagick::setOption — Set an option
Imagick::setPage — Sets the page geometry of the Imagick object
Imagick::setResolution — Sets the image resolution
Imagick::setResourceLimit — Sets the limit for a particular resource in megabytes
Imagick::setSamplingFactors — Sets the image sampling factors
Imagick::setSizeOffset — Sets the size and offset of the Imagick object
Imagick::setSize — Sets the size of the Imagick object
Imagick::setType — Sets the image type attribute
Imagick::shadeImage — Creates a 3D effect
Imagick::shadowImage — Simulates an image shadow
Imagick::sharpenImage — Sharpens an image
Imagick::shaveImage — Shaves pixels from the image edges
Imagick::shearImage — Creating a parallelogram
Imagick::sigmoidalContrastImage — Adjusts the contrast of an image
Imagick::sketchImage — Simulates a pencil sketch
Imagick::solarizeImage — Applies a solarizing effect to the image
Imagick::spliceImage — Splices a solid color into the image
Imagick::spreadImage — Randomly displaces each pixel in a block
Imagick::steganoImage — Hides a digital watermark within the image
Imagick::stereoImage — Composites two images
Imagick::stripImage — Strips an image of all profiles and comments
Imagick::swirlImage — Swirls the pixels about the center of the image
Imagick::textureImage — Repeatedly tiles the texture image
Imagick::thresholdImage — Changes the value of individual pixels based on a threshold
Imagick::thumbnailImage — Changes the size of an image
Imagick::tintImage — Applies a color vector to each pixel in the image
Imagick::transverseImage — Creates a horizontal mirror image
Imagick::trimImage — Remove edges from the image
Imagick::uniqueImageColors — Discards all but one of any pixel color
Imagick::unsharpMaskImage — Sharpens an image
Imagick::valid — Checks if the current item is valid
Imagick::vignetteImage — Adds vignette filter to the image
Imagick::waveImage — Adds wave filter to the image
Imagick::whiteThresholdImage — Force all pixels above the threshold into white
Imagick::writeImages — Writes an image or image sequence
Imagick::writeImage — Writes an image to the specified filename
Imagick::displayImage — Displays an image
Imagick::displayImages — Displays an image or image sequence
Imagick::cropThumbnailImage — Creates a crop thumbnail
Imagick::roundCorners — Rounds image corners
Imagick::polaroidImage — Simulates a Polaroid picture
Imagick::queryFonts — Returns the configured fonts
Imagick::queryFontMetrics — Returns an array representing the font metrics
ImagickDraw::affine — Adjusts the current affine transformation matrix
ImagickDraw::annotation — Draws text on the image
ImagickDraw::arc — Draws an arc
ImagickDraw::bezier — Draws a bezier curve
ImagickDraw::circle — Draws a circle
ImagickDraw::clear — Clears the ImagickDraw
ImagickDraw::clone — Makes an exact copy of the specified ImagickDraw object
ImagickDraw::color — Draws color on image
ImagickDraw::comment — Adds a comment
ImagickDraw::composite — Composites an image onto the current image
ImagickDraw::__construct — The ImagickDraw constructor
ImagickDraw::destroy — Frees all associated resources
ImagickDraw::ellipse — Draws an ellipse on the image
ImagickDraw::getClipPath — Obtains the current clipping path ID
ImagickDraw::getClipRule — Returns the current polygon fill rule
ImagickDraw::getClipUnits — Returns the interpretation of clip path units
ImagickDraw::getFillColor — Returns the fill color
ImagickDraw::getFillOpacity — Returns the opacity used when drawing
ImagickDraw::getFillRule — Returns the fill rule
ImagickDraw::getFontFamily — Returns the font family
ImagickDraw::getFontSize — Returns the font pointsize
ImagickDraw::getFontStyle — Returns the font style
ImagickDraw::getFontWeight — Returns the font weight
ImagickDraw::getFont — Returns the font
ImagickDraw::getGravity — Returns the text placement gravity
ImagickDraw::getStrokeAntialias — Returns the current stroke antialias setting
ImagickDraw::getStrokeColor — Returns the color used for stroking object outlines
ImagickDraw::getStrokeDashArray — Returns an array representing the pattern of dashes and gaps used to stroke paths
ImagickDraw::getStrokeDashOffset — Returns the offset into the dash pattern to start the dash
ImagickDraw::getStrokeLineCap — Returns the shape to be used at the end of open subpaths when they are stroked
ImagickDraw::getStrokeLineJoin — Returns the shape to be used at the corners of paths when they are stroked
ImagickDraw::getStrokeMiterLimit — Returns the stroke miter limit
ImagickDraw::getStrokeOpacity — Returns the opacity of stroked object outlines
ImagickDraw::getStrokeWidth — Returns the width of the stroke used to draw object outlines
ImagickDraw::getTextAlignment — Returns the text alignment
ImagickDraw::getTextAntialias — Returns the current text antialias setting
ImagickDraw::getTextDecoration — Returns the text decoration
ImagickDraw::getTextEncoding — Returns the code set used for text annotations
ImagickDraw::getTextUnderColor — Returns the text under color
ImagickDraw::getVectorGraphics — Returns a string containing vector graphics
ImagickDraw::line — Draws a line
ImagickDraw::matte — Paints on the image's opacity channel
ImagickDraw::pathClose — Adds a path element to the current path
ImagickDraw::pathCurveToAbsolute — Draws a cubic Bezier curve
ImagickDraw::pathCurveToQuadraticBezierAbsolute — Draws a quadratic Bezier curve
ImagickDraw::pathCurveToQuadraticBezierRelative — Draws a quadratic Bezier curve
ImagickDraw::pathCurveToQuadraticBezierSmoothAbsolute — Draws a quadratic Bezier curve
ImagickDraw::pathCurveToQuadraticBezierSmoothRelative — Draws a quadratic Bezier curve
ImagickDraw::pathCurveToRelative — Draws a cubic Bezier curve
ImagickDraw::pathCurveToSmoothAbsolute — Draws a cubic Bezier curve
ImagickDraw::pathCurveToSmoothRelative — Draws a cubic Bezier curve
ImagickDraw::pathEllipticArcAbsolute — Draws an elliptical arc
ImagickDraw::pathEllipticArcRelative — Draws an elliptical arc
ImagickDraw::pathFinish — Terminates the current path
ImagickDraw::pathLineToAbsolute — Draws a line path
ImagickDraw::pathLineToHorizontalAbsolute — Draws a horizontal line path
ImagickDraw::pathLineToHorizontalRelative — Draws a horizontal line
ImagickDraw::pathLineToRelative — Draws a line path
ImagickDraw::pathLineToVerticalAbsolute — Draws a vertical line
ImagickDraw::pathLineToVerticalRelative — Draws a vertical line path
ImagickDraw::pathMoveToAbsolute — Starts a new sub-path
ImagickDraw::pathMoveToRelative — Starts a new sub-path
ImagickDraw::pathStart — Declares the start of a path drawing list
ImagickDraw::point — Draws a point
ImagickDraw::polygon — Draws a polygon
ImagickDraw::polyline — Draws a polyline
ImagickDraw::popClipPath — Terminates a clip path definition
ImagickDraw::popDefs — Terminates a definition list
ImagickDraw::pop — Destroys the current ImagickDraw in the stack, and returns to the previously pushed ImagickDraw
ImagickDraw::popPattern — Terminates a pattern definition
ImagickDraw::pushClipPath — Starts a clip path definition
ImagickDraw::pushDefs — Indicates that following commands create named elements for early processing
ImagickDraw::push — Clones the current ImagickDraw and pushes it to the stack
ImagickDraw::pushPattern — Indicates that subsequent commands up to a ImagickDraw::opPattern() command comprise the definition of a named pattern
ImagickDraw::rectangle — Draws a rectangle
ImagickDraw::render — Renders all preceding drawing commands onto the image
ImagickDraw::rotate — Applies the specified rotation to the current coordinate space
ImagickDraw::roundRectangle — Draws a rounted rectangle
ImagickDraw::scale — Adjusts the scaling factor
ImagickDraw::setClipPath — Associates a named clipping path with the image
ImagickDraw::setClipRule — Set the polygon fill rule to be used by the clipping path
ImagickDraw::setClipUnits — Sets the interpretation of clip path units
ImagickDraw::setFillAlpha — Sets the opacity to use when drawing using the fill color or fill texture
ImagickDraw::setFillColor — Sets the fill color to be used for drawing filled objects
ImagickDraw::setFillOpacity — Sets the opacity to use when drawing using the fill color or fill texture
ImagickDraw::setFillPatternURL — Sets the URL to use as a fill pattern for filling objects
ImagickDraw::setFillRule — Sets the fill rule to use while drawing polygons
ImagickDraw::setFontFamily — Sets the font family to use when annotating with text
ImagickDraw::setFontSize — Sets the font pointsize to use when annotating with text
ImagickDraw::setFontStretch — Sets the font stretch to use when annotating with text
ImagickDraw::setFontStyle — Sets the font style to use when annotating with text
ImagickDraw::setFontWeight — Sets the font weight
ImagickDraw::setFont — Sets the fully-specified font to use when annotating with text
ImagickDraw::setGravity — Sets the text placement gravity
ImagickDraw::setStrokeAlpha — Specifies the opacity of stroked object outlines
ImagickDraw::setStrokeAntialias — Controls whether stroked outlines are antialiased
ImagickDraw::setStrokeColor — Sets the color used for stroking object outlines
ImagickDraw::setStrokeDashArray — Specifies the pattern of dashes and gaps used to stroke paths
ImagickDraw::setStrokeDashOffset — Specifies the offset into the dash pattern to start the dash
ImagickDraw::setStrokeLineCap — Specifies the shape to be used at the end of open subpaths when they are stroked
ImagickDraw::setStrokeLineJoin — Specifies the shape to be used at the corners of paths when they are stroked
ImagickDraw::setStrokeMiterLimit — Specifies the miter limit
ImagickDraw::setStrokeOpacity — Specifies the opacity of stroked object outlines
ImagickDraw::setStrokePatternURL — Sets the pattern used for stroking object outlines
ImagickDraw::setStrokeWidth — Sets the width of the stroke used to draw object outlines
ImagickDraw::setTextAlignment — Specifies a text alignment
ImagickDraw::setTextAntialias — Controls whether text is antialiased
ImagickDraw::setTextDecoration — Specifies a decoration
ImagickDraw::setTextEncoding — Specifies specifies the text code set
ImagickDraw::setTextUnderColor — Specifies the color of a background rectangle
ImagickDraw::setVectorGraphics — Sets the vector graphics
ImagickDraw::setViewbox — Sets the overall canvas size
ImagickDraw::skewX — Skews the current coordinate system in the horizontal direction
ImagickDraw::skewY — Skews the current coordinate system in the vertical direction
ImagickDraw::translate — Applies a translation to the current coordinate system
ImagickPixel::clear — Clears resources associated with this object
ImagickPixel::__construct — The ImagickPixel constructor
ImagickPixel::destroy — Deallocates resources associated with this object
ImagickPixel::getColor — Returns the color
ImagickPixel::getColorCount — Returns the color count associated with this color
ImagickPixel::getColorValue — Gets the normalized value of the provided color channel
ImagickPixel::getHSL — Returns the normalized HSL color of the ImagickPixel object
ImagickPixel::isSimilar — Check the distance between this color and another
ImagickPixel::setColorValue — Sets the normalized value of one of the channels
ImagickPixel::setColor — Sets the color
ImagickPixel::setHSL — Sets the normalized HSL color
ImagickPixelIterator::clear — Clear resources associated with a PixelIterator
ImagickPixelIterator::__construct — The ImagickPixelIterator constructor
ImagickPixelIterator::destroy — Deallocates resources associated with a PixelIterator
ImagickPixelIterator::getCurrentIteratorRow — Returns the current row of ImagickPixel objects
ImagickPixelIterator::getIteratorRow — Returns the current pixel iterator row
ImagickPixelIterator::getNextIteratorRow — Returns the next row of the pixel iterator
ImagickPixelIterator::getPreviousIteratorRow — Returns the previous row
ImagickPixelIterator::newPixelIterator — Returns a new pixel iterator
ImagickPixelIterator::newPixelRegionIterator — Returns a new pixel iterator
ImagickPixelIterator::resetIterator — Resets the pixel iterator
ImagickPixelIterator::setIteratorFirstRow — Sets the pixel iterator to the first pixel row
ImagickPixelIterator::setIteratorLastRow — Sets the pixel iterator to the last pixel row
ImagickPixelIterator::setIteratorRow — Set the pixel iterator row
ImagickPixelIterator::syncIterator — Syncs the pixel iterator

Code Examples / Notes » ref.imagick

mlong-php

The fit functionality of thumbnailImage doesn't work as one would anticipate. Instead, use this to make a thumbnail that has max of 200x82:
 // Create thumbnail max of 200x82
 $width=$im->getImageWidth();
 if ($width > 200) { $im->thumbnailImage(200,null,0); }
 $height=$im->getImageHeight();
 if ($height > 82) { $im->thumbnailImage(null,82,0); }


gmail dot com

In case anyone is wondering about some examples for Imagick usage, take a look at Mikko Koppanen's blog at http://valokuva.org/?cat=1.

mlong-php

Here is an example on how to take an image that is already in a string (say, from a database), and resize it, add a border, and print it out. I use this for showing reseller logos
 // Decode image from base64
 $image=base64_decode($imagedata);
 // Create Imagick object
 $im = new Imagick();
 // Convert image into Imagick
 $im->readimageblob($image);
 // Create thumbnail max of 200x82
 $im->thumbnailImage(200,82,true);
 // Add a subtle border
 $color=new ImagickPixel();
 $color->setColor("rgb(220,220,220)");
 $im->borderImage($color,1,1);
 // Output the image
 $output = $im->getimageblob();
 $outputtype = $im->getFormat();
 header("Content-type: $outputtype");
 echo $output;


Change Language


Follow Navioo On Twitter
.NET Functions
Apache-specific Functions
Alternative PHP Cache
Advanced PHP debugger
Array Functions
Aspell functions [deprecated]
BBCode Functions
BCMath Arbitrary Precision Mathematics Functions
PHP bytecode Compiler
Bzip2 Compression Functions
Calendar Functions
CCVS API Functions [deprecated]
Class/Object Functions
Classkit Functions
ClibPDF Functions [deprecated]
COM and .Net (Windows)
Crack Functions
Character Type Functions
CURL
Cybercash Payment Functions
Credit Mutuel CyberMUT functions
Cyrus IMAP administration Functions
Date and Time Functions
DB++ Functions
Database (dbm-style) Abstraction Layer Functions
dBase Functions
DBM Functions [deprecated]
dbx Functions
Direct IO Functions
Directory Functions
DOM Functions
DOM XML Functions
enchant Functions
Error Handling and Logging Functions
Exif Functions
Expect Functions
File Alteration Monitor Functions
Forms Data Format Functions
Fileinfo Functions
filePro Functions
Filesystem Functions
Filter Functions
Firebird/InterBase Functions
Firebird/Interbase Functions (PDO_FIREBIRD)
FriBiDi Functions
FrontBase Functions
FTP Functions
Function Handling Functions
GeoIP Functions
Gettext Functions
GMP Functions
gnupg Functions
Net_Gopher
Haru PDF Functions
hash Functions
HTTP
Hyperwave Functions
Hyperwave API Functions
i18n Functions
IBM Functions (PDO_IBM)
IBM DB2
iconv Functions
ID3 Functions
IIS Administration Functions
Image Functions
Imagick Image Library
IMAP
Informix Functions
Informix Functions (PDO_INFORMIX)
Ingres II Functions
IRC Gateway Functions
PHP / Java Integration
JSON Functions
KADM5
LDAP Functions
libxml Functions
Lotus Notes Functions
LZF Functions
Mail Functions
Mailparse Functions
Mathematical Functions
MaxDB PHP Extension
MCAL Functions
Mcrypt Encryption Functions
MCVE (Monetra) Payment Functions
Memcache Functions
Mhash Functions
Mimetype Functions
Ming functions for Flash
Miscellaneous Functions
mnoGoSearch Functions
Microsoft SQL Server Functions
Microsoft SQL Server and Sybase Functions (PDO_DBLIB)
Mohawk Software Session Handler Functions
mSQL Functions
Multibyte String Functions
muscat Functions
MySQL Functions
MySQL Functions (PDO_MYSQL)
MySQL Improved Extension
Ncurses Terminal Screen Control Functions
Network Functions
Newt Functions
NSAPI-specific Functions
Object Aggregation/Composition Functions
Object property and method call overloading
Oracle Functions
ODBC Functions (Unified)
ODBC and DB2 Functions (PDO_ODBC)
oggvorbis
OpenAL Audio Bindings
OpenSSL Functions
Oracle Functions [deprecated]
Oracle Functions (PDO_OCI)
Output Control Functions
Ovrimos SQL Functions
Paradox File Access
Parsekit Functions
Process Control Functions
Regular Expression Functions (Perl-Compatible)
PDF Functions
PDO Functions
Phar archive stream and classes
PHP Options&Information
POSIX Functions
Regular Expression Functions (POSIX Extended)
PostgreSQL Functions
PostgreSQL Functions (PDO_PGSQL)
Printer Functions
Program Execution Functions
PostScript document creation
Pspell Functions
qtdom Functions
Radius
Rar Functions
GNU Readline
GNU Recode Functions
RPM Header Reading Functions
runkit Functions
SAM - Simple Asynchronous Messaging
Satellite CORBA client extension [deprecated]
SCA Functions
SDO Functions
SDO XML Data Access Service Functions
SDO Relational Data Access Service Functions
Semaphore
SESAM Database Functions
PostgreSQL Session Save Handler
Session Handling Functions
Shared Memory Functions
SimpleXML functions
SNMP Functions
SOAP Functions
Socket Functions
Standard PHP Library (SPL) Functions
SQLite Functions
SQLite Functions (PDO_SQLITE)
Secure Shell2 Functions
Statistics Functions
Stream Functions
String Functions
Subversion Functions
Shockwave Flash Functions
Swish Functions
Sybase Functions
TCP Wrappers Functions
Tidy Functions
Tokenizer Functions
Unicode Functions
URL Functions
Variable Handling Functions
Verisign Payflow Pro Functions
vpopmail Functions
W32api Functions
WDDX Functions
win32ps Functions
win32service Functions
xattr Functions
xdiff Functions
XML Parser Functions
XML-RPC Functions
XMLReader functions
XMLWriter Functions
XSL functions
XSLT Functions
YAZ Functions
YP/NIS Functions
Zip File Functions
Zlib Compression Functions
eXTReMe Tracker