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



PHP : Function Reference : Imagick Image Library : Imagick::annotateImage

Imagick::annotateImage

Annotates an image with text ()
bool Imagick::annotateImage ( ImagickDraw draw_settings, float x, float y, float angle, string text )

Example 1033. Using Imagick::annotateImage():

Annotate text on an empty image

<?php
/* Create some objects */
$image = new Imagick();
$draw = new ImagickDraw();
$pixel = new ImagickPixel( 'gray' );

/* New image */
$image->newImage(800, 75, $pixel);

/* Black text */
$pixel->setColor('black');

/* Font properties */
$draw->setFont('Bookman-DemiItalic');
$draw->setFontSize( 30 );

/* Create text */
$image->annotateImage($draw, 10, 45, 0, 'The quick brown fox jumps over the lazy dog');

/* Give image a format */
$image->setImageFormat('png');

/* Output the image with headers */
header('Content-type: image/png');
echo
$image;

?>

Related Examples ( Source code ) » imagick annotateimage
















Code Examples / Notes » imagick annotateimage

alan

If ImagickDraw::setGravity ( int $gravity ) has been set, e,g; with $gravity= imagick::GRAVITY_CENTER.
Then, the x and y values offset the text from where the gravity setting would have placed it.
If the example included: $draw->setGravity (Imagick::GRAVITY_CENTER);
$image->annotateImage($draw, 10, 45, 0, 'The quick brown fox jumps over the lazy dog');
The text would be rendered to the right 10px and down 45px from the center.  
Gravity constants are very useful as they can save having to calculate the placement of variable text strings and font sizes.


Change Language


Follow Navioo On Twitter
Constants
Installation
Imagick
Imagick::adaptiveBlurImage
Imagick::adaptiveResizeImage
Imagick::adaptiveSharpenImage
Imagick::adaptiveThresholdImage
Imagick::addImage
Imagick::addNoiseImage
Imagick::affineTransformImage
Imagick::annotateImage
Imagick::appendImages
Imagick::averageImages
Imagick::blackThresholdImage
Imagick::blurImage
Imagick::borderImage
Imagick::charcoalImage
Imagick::chopImage
Imagick::clear
Imagick::clipImage
Imagick::clipPathImage
Imagick::clone
Imagick::coalesceImages
Imagick::colorFloodfillImage
Imagick::colorizeImage
Imagick::clutImage
Imagick::combineImages
Imagick::commentImage
Imagick::compareImageChannels
Imagick::compareImageLayers
Imagick::compositeImage
Imagick::__construct
Imagick::contrastImage
Imagick::contrastStretchImage
Imagick::convolveImage
Imagick::cropImage
Imagick::current
Imagick::cycleColormapImage
Imagick::deconstructImages
Imagick::despeckleImage
Imagick::destroy
Imagick::drawImage
Imagick::edgeImage
Imagick::embossImage
Imagick::enhanceImage
Imagick::equalizeImage
Imagick::evaluateImage
Imagick::flattenImages
Imagick::flipImage
Imagick::flopImage
Imagick::frameImage
Imagick::fxImage
Imagick::gammaImage
Imagick::gaussianBlurImage
Imagick::getCompressionQuality
Imagick::getCompression
Imagick::getCopyright
Imagick::getFilename
Imagick::getFormat
Imagick::getHomeURL
Imagick::getImageBackgroundColor
Imagick::getImageBlob
Imagick::getImageBluePrimary
Imagick::getImageBorderColor
Imagick::getImageChannelDepth
Imagick::getImageChannelDistortion
Imagick::getImageChannelExtrema
Imagick::getImageChannelMean
Imagick::getImageChannelStatistics
Imagick::getImageColormapColor
Imagick::getImageColorspace
Imagick::getImageColors
Imagick::getImageCompose
Imagick::getImageDelay
Imagick::getImageDepth
Imagick::getImageDispose
Imagick::getImageDistortion
Imagick::getImageExtrema
Imagick::getImageFilename
Imagick::getImageSize
Imagick::getImageLength
Imagick::getImageFormat
Imagick::getImageGamma
Imagick::getImageGeometry
Imagick::getImageGreenPrimary
Imagick::getImageHeight
Imagick::getImageHistogram
Imagick::getImageIndex
Imagick::getIteratorIndex
Imagick::getImageInterlaceScheme
Imagick::getImageInterpolateMethod
Imagick::getImageIterations
Imagick::getImageMatteColor
Imagick::getImageMatte
Imagick::getImagePage
Imagick::getImagePixelColor
Imagick::getImageProfile
Imagick::getImageProfiles
Imagick::getImageProperty
Imagick::getImageProperties
Imagick::getImageRedPrimary
Imagick::getImageRegion
Imagick::getImageRenderingIntent
Imagick::getImageResolution
Imagick::getImageScene
Imagick::getImageSignature
Imagick::getImageTicksPerSecond
Imagick::getImageTotalInkDensity
Imagick::getImageType
Imagick::getImageUnits
Imagick::getImageVirtualPixelMethod
Imagick::getImageWhitePoint
Imagick::getImageWidth
Imagick::getImage
Imagick::getInterlaceScheme
Imagick::getImageOrientation
Imagick::getNumberImages
Imagick::getOption
Imagick::getPackageName
Imagick::getPage
Imagick::getPixelIterator
Imagick::getPixelRegionIterator
Imagick::getQuantumDepth
Imagick::getQuantumRange
Imagick::getReleaseDate
Imagick::getResourceLimit
Imagick::getResource
Imagick::getSamplingFactors
Imagick::getSizeOffset
Imagick::getSize
Imagick::getVersion
Imagick::hasNextImage
Imagick::hasPreviousImage
Imagick::identifyImage
Imagick::implodeImage
Imagick::labelImage
Imagick::levelImage
Imagick::linearStretchImage
Imagick::magnifyImage
Imagick::matteFloodfillImage
Imagick::medianFilterImage
Imagick::minifyImage
Imagick::modulateImage
Imagick::montageImage
Imagick::morphImages
Imagick::compareImages
Imagick::mosaicImages
Imagick::motionBlurImage
Imagick::negateImage
Imagick::distortImage
Imagick::newImage
Imagick::setImage
Imagick::setImageOpacity
Imagick::newPseudoImage
Imagick::nextImage
Imagick::normalizeImage
Imagick::oilPaintImage
Imagick::optimizeImageLayers
Imagick::paintOpaqueImage
Imagick::paintTransparentImage
Imagick::pingImageBlob
Imagick::pingImageFile
Imagick::pingImage
Imagick::posterizeImage
Imagick::previousImage
Imagick::profileImage
Imagick::queryFormats
Imagick::radialBlurImage
Imagick::raiseImage
Imagick::randomThresholdImage
Imagick::readImageBlob
Imagick::readImageFile
Imagick::readImage
Imagick::reduceNoiseImage
Imagick::removeImageProfile
Imagick::removeImage
Imagick::render
Imagick::resampleImage
Imagick::resizeImage
Imagick::rollImage
Imagick::rotateImage
Imagick::sampleImage
Imagick::scaleImage
Imagick::separateImageChannel
Imagick::sepiaToneImage
Imagick::setBackgroundColor
Imagick::setCompressionQuality
Imagick::setCompression
Imagick::setFilename
Imagick::setFirstIterator
Imagick::setLastIterator
Imagick::setFormat
Imagick::setImageBackgroundColor
Imagick::setImageBias
Imagick::setImageBluePrimary
Imagick::setImageBorderColor
Imagick::setImageChannelDepth
Imagick::setImageColormapColor
Imagick::setImageColorspace
Imagick::setImageCompose
Imagick::setImageCompression
Imagick::setImageDelay
Imagick::setImageDepth
Imagick::setImageDispose
Imagick::setImageExtent
Imagick::setImageFilename
Imagick::setImageFormat
Imagick::setImageGamma
Imagick::setImageGreenPrimary
Imagick::setImageIndex
Imagick::setIteratorIndex
Imagick::setImageInterlaceScheme
Imagick::setImageInterpolateMethod
Imagick::setImageIterations
Imagick::setImageMatteColor
Imagick::setImageMatte
Imagick::setImagePage
Imagick::setImageProfile
Imagick::setImageProperty
Imagick::setImageRedPrimary
Imagick::setImageRenderingIntent
Imagick::setImageResolution
Imagick::setImageScene
Imagick::setImageTicksPerSecond
Imagick::setImageType
Imagick::setImageUnits
Imagick::setImageVirtualPixelMethod
Imagick::setImageWhitePoint
Imagick::setInterlaceScheme
Imagick::setImageOrientation
Imagick::setOption
Imagick::setPage
Imagick::setResolution
Imagick::setResourceLimit
Imagick::setSamplingFactors
Imagick::setSizeOffset
Imagick::setSize
Imagick::setType
Imagick::shadeImage
Imagick::shadowImage
Imagick::sharpenImage
Imagick::shaveImage
Imagick::shearImage
Imagick::sigmoidalContrastImage
Imagick::sketchImage
Imagick::solarizeImage
Imagick::spliceImage
Imagick::spreadImage
Imagick::steganoImage
Imagick::stereoImage
Imagick::stripImage
Imagick::swirlImage
Imagick::textureImage
Imagick::thresholdImage
Imagick::thumbnailImage
Imagick::tintImage
Imagick::transverseImage
Imagick::trimImage
Imagick::uniqueImageColors
Imagick::unsharpMaskImage
Imagick::valid
Imagick::vignetteImage
Imagick::waveImage
Imagick::whiteThresholdImage
Imagick::writeImages
Imagick::writeImage
Imagick::displayImage
Imagick::displayImages
Imagick::cropThumbnailImage
Imagick::roundCorners
Imagick::polaroidImage
Imagick::queryFonts
Imagick::queryFontMetrics
ImagickDraw::affine
ImagickDraw::annotation
ImagickDraw::arc
ImagickDraw::bezier
ImagickDraw::circle
ImagickDraw::clear
ImagickDraw::clone
ImagickDraw::color
ImagickDraw::comment
ImagickDraw::composite
ImagickDraw::__construct
ImagickDraw::destroy
ImagickDraw::ellipse
ImagickDraw::getClipPath
ImagickDraw::getClipRule
ImagickDraw::getClipUnits
ImagickDraw::getFillColor
ImagickDraw::getFillOpacity
ImagickDraw::getFillRule
ImagickDraw::getFontFamily
ImagickDraw::getFontSize
ImagickDraw::getFontStyle
ImagickDraw::getFontWeight
ImagickDraw::getFont
ImagickDraw::getGravity
ImagickDraw::getStrokeAntialias
ImagickDraw::getStrokeColor
ImagickDraw::getStrokeDashArray
ImagickDraw::getStrokeDashOffset
ImagickDraw::getStrokeLineCap
ImagickDraw::getStrokeLineJoin
ImagickDraw::getStrokeMiterLimit
ImagickDraw::getStrokeOpacity
ImagickDraw::getStrokeWidth
ImagickDraw::getTextAlignment
ImagickDraw::getTextAntialias
ImagickDraw::getTextDecoration
ImagickDraw::getTextEncoding
ImagickDraw::getTextUnderColor
ImagickDraw::getVectorGraphics
ImagickDraw::line
ImagickDraw::matte
ImagickDraw::pathClose
ImagickDraw::pathCurveToAbsolute
ImagickDraw::pathCurveToQuadraticBezierAbsolute
ImagickDraw::pathCurveToQuadraticBezierRelative
ImagickDraw::pathCurveToQuadraticBezierSmoothAbsolute
ImagickDraw::pathCurveToQuadraticBezierSmoothRelative
ImagickDraw::pathCurveToRelative
ImagickDraw::pathCurveToSmoothAbsolute
ImagickDraw::pathCurveToSmoothRelative
ImagickDraw::pathEllipticArcAbsolute
ImagickDraw::pathEllipticArcRelative
ImagickDraw::pathFinish
ImagickDraw::pathLineToAbsolute
ImagickDraw::pathLineToHorizontalAbsolute
ImagickDraw::pathLineToHorizontalRelative
ImagickDraw::pathLineToRelative
ImagickDraw::pathLineToVerticalAbsolute
ImagickDraw::pathLineToVerticalRelative
ImagickDraw::pathMoveToAbsolute
ImagickDraw::pathMoveToRelative
ImagickDraw::pathStart
ImagickDraw::point
ImagickDraw::polygon
ImagickDraw::polyline
ImagickDraw::popClipPath
ImagickDraw::popDefs
ImagickDraw::pop
ImagickDraw::popPattern
ImagickDraw::pushClipPath
ImagickDraw::pushDefs
ImagickDraw::push
ImagickDraw::pushPattern
ImagickDraw::rectangle
ImagickDraw::render
ImagickDraw::rotate
ImagickDraw::roundRectangle
ImagickDraw::scale
ImagickDraw::setClipPath
ImagickDraw::setClipRule
ImagickDraw::setClipUnits
ImagickDraw::setFillAlpha
ImagickDraw::setFillColor
ImagickDraw::setFillOpacity
ImagickDraw::setFillPatternURL
ImagickDraw::setFillRule
ImagickDraw::setFontFamily
ImagickDraw::setFontSize
ImagickDraw::setFontStretch
ImagickDraw::setFontStyle
ImagickDraw::setFontWeight
ImagickDraw::setFont
ImagickDraw::setGravity
ImagickDraw::setStrokeAlpha
ImagickDraw::setStrokeAntialias
ImagickDraw::setStrokeColor
ImagickDraw::setStrokeDashArray
ImagickDraw::setStrokeDashOffset
ImagickDraw::setStrokeLineCap
ImagickDraw::setStrokeLineJoin
ImagickDraw::setStrokeMiterLimit
ImagickDraw::setStrokeOpacity
ImagickDraw::setStrokePatternURL
ImagickDraw::setStrokeWidth
ImagickDraw::setTextAlignment
ImagickDraw::setTextAntialias
ImagickDraw::setTextDecoration
ImagickDraw::setTextEncoding
ImagickDraw::setTextUnderColor
ImagickDraw::setVectorGraphics
ImagickDraw::setViewbox
ImagickDraw::skewX
ImagickDraw::skewY
ImagickDraw::translate
ImagickPixel::clear
ImagickPixel::__construct
ImagickPixel::destroy
ImagickPixel::getColor
ImagickPixel::getColorCount
ImagickPixel::getColorValue
ImagickPixel::getHSL
ImagickPixel::isSimilar
ImagickPixel::setColorValue
ImagickPixel::setColor
ImagickPixel::setHSL
ImagickPixelIterator::clear
ImagickPixelIterator::__construct
ImagickPixelIterator::destroy
ImagickPixelIterator::getCurrentIteratorRow
ImagickPixelIterator::getIteratorRow
ImagickPixelIterator::getNextIteratorRow
ImagickPixelIterator::getPreviousIteratorRow
ImagickPixelIterator::newPixelIterator
ImagickPixelIterator::newPixelRegionIterator
ImagickPixelIterator::resetIterator
ImagickPixelIterator::setIteratorFirstRow
ImagickPixelIterator::setIteratorLastRow
ImagickPixelIterator::setIteratorRow
ImagickPixelIterator::syncIterator
eXTReMe Tracker