LXVI. Image magick Functions

Introduction

Image magick extension lets you create and manipulate images. Its function is similar to Image extension but provides more powerful and faster functions.

Requirements

To use this extension, either "ImageMagick" or "GraphicsMagick" library is required.

Installation

Windows binaries may be found at http://snaps.php.net/. To install, download php_imagick.dll to the folder specified by your php.ini file's extension_dir directive. Enable it by adding extension=php_imagick.dll to your php.ini and restarting your web server.

extension_dir=c:/php5/exts/
extension=php_imagick.dll

Linux, BSD, and other *nix variants can be compiled using the following steps:

  • Either:

    • Run the pear installer for PECL/imagick: pecl install imagick

    • Copy imagick.so from the directory indicated by the build process to the location specified in your php.ini file under extension_dir.

    • Add extension=imagick.so to your php.ini

    Or:

    • Set the path to your php.ini via:

      pecl config-set php_ini /path/to/php.ini

    • Run the pear installer for PECL/imagick: pecl install imagick

  • Restart your web server to reload your php.ini settings.

Development Versions: There are currently no stable versions of PECL/imagick, to force installation of the beta version of PECL/imagick execute: pecl install imagick-beta

Compiling PECL/imagick without using the PEAR command: Rather than using pecl install imagick to automatically download and install PECL/imagick, you may download the tarball from PECL. From the root of the unpacked tarball, run: phpize && ./configure --enable-imagick && make to generate imagick.so. Once built, continue the installation from step 4 above.

Information for installing this PECL extension may be found in the manual chapter titled Installation of PECL extensions. Additional information such as new releases, downloads, source files, maintainer information, and a CHANGELOG, can be located here: http://pecl.php.net/package/imagick.

Resource Types

This extension uses the "imagemagick handle" resource.

Predefined Constants

The constants below are defined by this extension, and will only be available when the extension has either been compiled into PHP or dynamically loaded at runtime.

IMAGICK_FILTER_UNDEFINED (integer)

IMAGICK_FILTER_POINT (integer)

IMAGICK_FILTER_BOX (integer)

IMAGICK_FILTER_TRIANGLE (integer)

IMAGICK_FILTER_HERMITE (integer)

IMAGICK_FILTER_HANNING (integer)

IMAGICK_FILTER_HAMMING (integer)

IMAGICK_FILTER_BLACKMAN (integer)

IMAGICK_FILTER_GAUSSIAN (integer)

IMAGICK_FILTER_QUADRATIC (integer)

IMAGICK_FILTER_CUBIC (integer)

IMAGICK_FILTER_CATROM (integer)

IMAGICK_FILTER_MITCHELL (integer)

IMAGICK_FILTER_LANCZOS (integer)

IMAGICK_FILTER_BESSEL (integer)

IMAGICK_FILTER_SINC (integer)

IMAGICK_FILTER_UNKNOWN (integer)

IMAGICK_FONTSTYLE_NORMAL (integer)

IMAGICK_FONTSTYLE_ITALIC (integer)

IMAGICK_FONTSTYLE_OBLIQUE (integer)

IMAGICK_FONTSTYLE_ANY (integer)

IMAGICK_RAISE (integer)

IMAGICK_LOWER (integer)

IMAGICK_COMPOSITE_OP_UNDEFINED (integer)

IMAGICK_COMPOSITE_OP_OVER (integer)

IMAGICK_COMPOSITE_OP_IN (integer)

IMAGICK_COMPOSITE_OP_OUT (integer)

IMAGICK_COMPOSITE_OP_ATOP (integer)

IMAGICK_COMPOSITE_OP_XOR (integer)

IMAGICK_COMPOSITE_OP_PLUS (integer)

IMAGICK_COMPOSITE_OP_MINUS (integer)

IMAGICK_COMPOSITE_OP_ADD (integer)

IMAGICK_COMPOSITE_OP_SUBTRACT (integer)

IMAGICK_COMPOSITE_OP_DIFFERENCE (integer)

IMAGICK_COMPOSITE_OP_MULTIPLY (integer)

IMAGICK_COMPOSITE_OP_BUMPMAP (integer)

IMAGICK_COMPOSITE_OP_COPY (integer)

IMAGICK_COMPOSITE_OP_COPYRED (integer)

IMAGICK_COMPOSITE_OP_COPYGREEN (integer)

IMAGICK_COMPOSITE_OP_COPYBLUE (integer)

IMAGICK_COMPOSITE_OP_COPYOPACITY (integer)

IMAGICK_COMPOSITE_OP_CLEAR (integer)

IMAGICK_COMPOSITE_OP_DISSOLVE (integer)

IMAGICK_COMPOSITE_OP_DISPLACE (integer)

IMAGICK_COMPOSITE_OP_MODULATE (integer)

IMAGICK_COMPOSITE_OP_THRESHOLD (integer)

IMAGICK_COMPOSITE_OP_NONE (integer)

IMAGICK_COMPOSITE_OP_DARKEN (integer)

IMAGICK_COMPOSITE_OP_LIGHTEN (integer)

IMAGICK_COMPOSITE_OP_HUE (integer)

IMAGICK_COMPOSITE_OP_SATURATE (integer)

IMAGICK_COMPOSITE_OP_COLORIZE (integer)

IMAGICK_COMPOSITE_OP_LUMINIZE (integer)

IMAGICK_COMPOSITE_OP_SCREEN (integer)

IMAGICK_COMPOSITE_OP_OVERLAY (integer)

IMAGICK_PROFILE_OWN (integer)

IMAGICK_PROFILE_COPY (integer)

IMAGICK_TYPE_UNDEFINED (integer)

IMAGICK_TYPE_BILEVEL (integer)

IMAGICK_TYPE_GRAYSCALE (integer)

IMAGICK_TYPE_GRAYSCALEMATTE (integer)

IMAGICK_TYPE_PALETTE (integer)

IMAGICK_TYPE_PALETTEMATTE (integer)

IMAGICK_TYPE_TRUECOLOR (integer)

IMAGICK_TYPE_TRUECOLORMATTE (integer)

IMAGICK_TYPE_COLORSEPARATION (integer)

IMAGICK_TYPE_COLORSEPARATIONMATTE (integer)

IMAGICK_TYPE_OPTIMIZE (integer)

IMAGICK_COLORSPACE_UNDEFINED (integer)

IMAGICK_COLORSPACE_RGB (integer)

IMAGICK_COLORSPACE_GRAY (integer)

IMAGICK_COLORSPACE_TRANSPARENT (integer)

IMAGICK_COLORSPACE_OHTA (integer)

IMAGICK_COLORSPACE_XYZ (integer)

IMAGICK_COLORSPACE_YCBCR (integer)

IMAGICK_COLORSPACE_YCC (integer)

IMAGICK_COLORSPACE_YIQ (integer)

IMAGICK_COLORSPACE_YPBPR (integer)

IMAGICK_COLORSPACE_YUV (integer)

IMAGICK_COLORSPACE_CMYK (integer)

IMAGICK_COLORSPACE_SRGB (integer)

IMAGICK_COMPRESSION_UNDEFINED (integer)

IMAGICK_COMPRESSION_NONE (integer)

IMAGICK_COMPRESSION_BZIP (integer)

IMAGICK_COMPRESSION_FAX (integer)

IMAGICK_COMPRESSION_GROUP4 (integer)

IMAGICK_COMPRESSION_JPEG (integer)

IMAGICK_COMPRESSION_LOSSLESSJPEG (integer)

IMAGICK_COMPRESSION_LZW (integer)

IMAGICK_COMPRESSION_RLE (integer)

IMAGICK_COMPRESSION_ZIP (integer)

Table of Contents
imagick_begindraw -- Begin draw
imagick_blob2image -- Read image from BLOB
imagick_blur -- Blur image
imagick_border -- Surrounds the image with a border
imagick_charcoal -- Highlight edges
imagick_chop -- Remove a region of an image and collapse the image to occupy the removed portion
imagick_clonehandle -- Clone image
imagick_composite -- Composite the second image onto the first at the specified offsets
imagick_contrast -- Enhance the intensity differences between the lighter and darker elements of the image
imagick_convert -- Convert image
imagick_crop -- Extract a region of the image
imagick_despeckle -- Reduce the speckle noise
imagick_destroyhandle -- Free image from memory
imagick_drawannotation -- Write text
imagick_drawarc -- Draw arc
imagick_drawcircle -- Draw circle
imagick_drawellipse -- Draw ellipse
imagick_drawline -- Draw line
imagick_drawpoint -- Draw point
imagick_drawrectangle -- Draw rectangle
imagick_edge -- Find edges
imagick_emboss -- Return a grayscale image with a three-dimensional effect
imagick_enhance -- Apply a digital filter that improves the quality of a noisy image
imagick_equalize -- Apply a histogram equalization to the image
imagick_error -- Check whether there is an error
imagick_faileddescription -- Get description of failure
imagick_failedreason -- Get reason of failure
imagick_first -- Set the internal pointer of an image list to its first element
imagick_flatten -- Merge a sequence of images
imagick_flip -- Create a vertical mirror image by reflecting the pixels around the central x-axis
imagick_flop -- Create a horizontal mirror image by reflecting the pixels around the central y-axis
imagick_frame -- Add a simulated three-dimensional border around the image
imagick_free -- Alias of imagick_destroyhandle()
imagick_gamma -- Gamma-correct a particular image channel
imagick_gaussianblur -- Blur image
imagick_getcanvas -- Get canvas
imagick_getcolorspace -- Get color space
imagick_getdpix -- Get DPI in X axis
imagick_getdpiy -- Get DPI in Y axis
imagick_getheight -- Get height
imagick_getimagedepth -- Get color depth
imagick_getimagefromlist -- Return copy of an image from the list
imagick_getimagetype -- Get image type
imagick_getlistindex -- Get position in the list of the specified image
imagick_getlistsize -- Get list size
imagick_getmagick -- Get Magick string
imagick_getmimetype -- Get MIME type
imagick_getnumbercolors -- Get number of colors
imagick_getwidth -- Get width
imagick_goto -- Go to specified image in a list
imagick_image2blob -- Return image as BLOB
imagick_implode -- Implode image pixels
imagick_iserror -- Check whether there is an error with image
imagick_isgrayimage -- Check whether image is gray
imagick_isimagesequal -- Compare two images
imagick_ismonochromeimage -- Check whether image is monochrome
imagick_isopaqueimage -- Check whether image is opaque
imagick_ispaletteimage -- Check whether image is palette
imagick_level -- Adjust levels of a particular image channel by scaling the colors falling between specified white and black points to the full available quantum range
imagick_magnify -- Double-size the image using bilinear interpolation
imagick_medianfilter -- Replace each pixel by the median in a set of neighboring pixels
imagick_minify -- Half-size the image using the weighted average of a 4x4 cell
imagick_modulate -- Control brightness, saturation and hue
imagick_mosaic -- Inlay a number of images to form a single coherent picture
imagick_motionblur -- Simulate motion blur
imagick_negate -- Negate the colors
imagick_newimagelist -- Create new image list
imagick_next -- Advance the internal pointer of an image list
imagick_normalize -- Enhance the contrast of a color image by mapping the darkest 2 percent of all pixel to black and the brightest 1 percent to white
imagick_oilpaint -- Simulate oil painting
imagick_ordereddither -- Use the ordered dithering technique of reducing color images to monochrome
imagick_poplist -- Remove the last image in the list
imagick_prev -- Rewind the internal pointer of an image list
imagick_profile -- Add or remove a ICC, IPTC, or generic profile from an image
imagick_pushlist -- Add an image to the end of the list
imagick_raise -- Create a simulated three-dimensional button-like effect
imagick_read -- Alias of imagick_readimage()
imagick_readimage -- Read image
imagick_reducenoise -- Smooth the contours of an image while still preserving edge information
imagick_resize -- Resize image
imagick_roll -- Offset an image as defined by x and y
imagick_rotate -- Rotate image
imagick_sample -- Scale image using pixel sampling
imagick_scale -- Scale image using pnmscale() of PBMPLUS
imagick_set_image_comment -- Set "comment" attribute of image
imagick_set_image_quality -- Set image quality
imagick_setcompressionquality -- Set compression quality
imagick_setcompressiontype -- Set compression type
imagick_setdpi -- Set DPI
imagick_setfillcolor -- Set fill color
imagick_setfillopacity -- Set fill opacity
imagick_setfontface -- Set font face
imagick_setfontsize -- Set font size
imagick_setfontstyle -- Set font style
imagick_shade -- Shine a distant light on an image to create a three-dimensional effect
imagick_sharpen -- Sharpen image
imagick_shear -- Slide one edge of an image along the X or Y axis, creating a parallelogram
imagick_solarize -- Solarize image
imagick_spread -- Randomly displace each pixel in a block
imagick_swirl -- Swirl pixels around the center of image
imagick_threshold -- Change the value of individual pixels based on the intensity of each pixel compared to threshold
imagick_transformrgb -- Convert the image from RGB to an alternate colorspace
imagick_transparent -- Make image transparent
imagick_unsharpmask -- Sharpen image
imagick_wave -- Creates a ripple effect in the image by shifting the pixels vertically along a sine wave
imagick_writeimage -- Write image
imagick_writeimages -- Write images
imagick_zoom -- Zoom image using selected filter