使用示例
<?php //初始化一个新的Gmagick对象 $image = new Gmagick('example.jpg'); //通过加载的图片生成缩略图(保持纵横比). $image->thumbnailImage(100, 0); //创建图片的边框, 然后模拟图像使其看上去像一幅油画 $image->borderImage("yellow", 8, 8)->oilPaintImage(0.3); //将当前图片写入到一个文件 $image->write('example_thumbnail.jpg'); ?>
相关和类函数
1.Gmagick类
- Gmagick::addimage — 添加一张新的图片到 Gmagick 对象图片列表
- Gmagick::addnoiseimage — 添加随机噪声到图片
- Gmagick::annotateimage — 为图片添加文字注释
- Gmagick::blurimage — 为图像添加模糊滤镜效果
- Gmagick::borderimage — 在图像四周添加边框
- Gmagick::charcoalimage — 模拟素描
- Gmagick::chopimage — 从图像中移除一块区域
- Gmagick::clear — 清除与Gmagick对象相关的所有资源
- Gmagick::commentimage — 添加注释到图像
- Gmagick::compositeimage — 合成一个图像到另一个图像
- Gmagick::__construct — Gmagick构造器
- Gmagick::cropimage — 裁剪获取图片指定区域
- Gmagick::cropthumbnailimage — 先缩放再裁剪从而创建一个指定尺寸的缩略图
- Gmagick::current — 当前目标
- Gmagick::cyclecolormapimage — Displaces an image's colormap
- Gmagick::deconstructimages — Returns certain pixel differences between images
- Gmagick::despeckleimage — The despeckleimage purpose
- Gmagick::destroy — 销毁Gmagick对象,释放内存空间
- Gmagick::drawimage — Renders the GmagickDraw object on the current image
- Gmagick::edgeimage — Enhance edges within the image
- Gmagick::embossimage — Returns a grayscale image with a three-dimensional effect
- Gmagick::enhanceimage — Improves the quality of a noisy image
- Gmagick::equalizeimage — Equalizes the image histogram
- Gmagick::flipimage — Creates a vertical mirror image
- Gmagick::flopimage — The flopimage purpose
- Gmagick::frameimage — Adds a simulated three-dimensional border
- Gmagick::gammaimage — Gamma-corrects an image
- Gmagick::getcopyright — Returns the GraphicsMagick API copyright as a string
- Gmagick::getfilename — The filename associated with an image sequence
- Gmagick::getimagebackgroundcolor — Returns the image background color
- Gmagick::getimageblueprimary — Returns the chromaticy blue primary point
- Gmagick::getimagebordercolor — Returns the image border color
- Gmagick::getimagechanneldepth — Gets the depth for a particular image channel
- Gmagick::getimagecolors — Returns the color of the specified colormap index
- Gmagick::getimagecolorspace — Gets the image colorspace
- Gmagick::getimagecompose — Returns the composite operator associated with the image
- Gmagick::getimagedelay — Gets the image delay
- Gmagick::getimagedepth — Gets the depth of the image
- Gmagick::getimagedispose — Gets the image disposal method
- Gmagick::getimageextrema — Gets the extrema for the image
- Gmagick::getimagefilename — Returns the filename of a particular image in a sequence
- Gmagick::getimageformat — Returns the format of a particular image in a sequence
- Gmagick::getimagegamma — Gets the image gamma
- Gmagick::getimagegreenprimary — Returns the chromaticy green primary point
- Gmagick::getimageheight — 返回图像高度
- Gmagick::getimagehistogram — Gets the image histogram
- Gmagick::getimageindex — Gets the index of the current active image
- Gmagick::getimageinterlacescheme — Gets the image interlace scheme
- Gmagick::getimageiterations — Gets the image iterations
- Gmagick::getimagematte — Return if the image has a matte channel
- Gmagick::getimagemattecolor — Returns the image matte color
- Gmagick::getimageprofile — Returns the named image profile.
- Gmagick::getimageredprimary — Returns the chromaticity red primary point
- Gmagick::getimagerenderingintent — Gets the image rendering intent
- Gmagick::getimageresolution — Gets the image X and Y resolution
- Gmagick::getimagescene — Gets the image scene
- Gmagick::getimagesignature — Generates an SHA-256 message digest
- Gmagick::getimagetype — Gets the potential image type.
- Gmagick::getimageunits — Gets the image units of resolution
- Gmagick::getimagewhitepoint — Returns the chromaticity white point
- Gmagick::getimagewidth — 返回图像宽度
- Gmagick::getpackagename — Returns the GraphicsMagick package name.
- Gmagick::getquantumdepth — Returns the Gmagick quantum depth as a string.
- Gmagick::getreleasedate — Returns the GraphicsMagick release date as a string.
- Gmagick::getsamplingfactors — Gets the horizontal and vertical sampling factor.
- Gmagick::getsize — 返回与当前gmagick对象相关联的尺寸
- Gmagick::getversion — 返回当前GraphicsMagick API的版本
- Gmagick::hasnextimage — 检查对象是否包含更多图像
- Gmagick::haspreviousimage — Checks if the object has a previous image
- Gmagick::implodeimage — Creates a new image as a copy
- Gmagick::labelimage — Adds a label to an image.
- Gmagick::levelimage — Adjusts the levels of an image
- Gmagick::magnifyimage — Scales an image proportionally 2x
- Gmagick::mapimage — Replaces the colors of an image with the closest color from a reference image.
- Gmagick::medianfilterimage — Applies a digital filter
- Gmagick::minifyimage — Scales an image proportionally to half its size
- Gmagick::modulateimage — Control the brightness, saturation, and hue
- Gmagick::motionblurimage — Simulates motion blur
- Gmagick::newimage — 创建一个新的图像
- Gmagick::nextimage — 移动到下一张图片
- Gmagick::normalizeimage — Enhances the contrast of a color image
- Gmagick::oilpaintimage — 模拟油画效果(使用示例:本篇文章开头的示例代码)
- Gmagick::previousimage — Move to the previous image in the object
- Gmagick::profileimage — Adds or removes a profile from an image
- Gmagick::quantizeimage — Analyzes the colors within a reference image
- Gmagick::quantizeimages — The quantizeimages purpose
- Gmagick::queryfontmetrics — Returns an array representing the font metrics
- Gmagick::queryfonts — Returns the configured fonts
- Gmagick::queryformats — Returns formats supported by Gmagick.
- Gmagick::radialblurimage — Radial blurs an image
- Gmagick::raiseimage — Creates a simulated 3d button-like effect
- Gmagick::read — 从文件名中读取图像
- Gmagick::readimage — 从文件名中读取图像
- Gmagick::readimageblob — Reads image from a binary string
- Gmagick::readimagefile — The readimagefile purpose
- Gmagick::reducenoiseimage — Smooths the contours of an image
- Gmagick::removeimage — Removes an image from the image list
- Gmagick::removeimageprofile — Removes the named image profile and returns it
- Gmagick::resampleimage — Resample image to desired resolution
- Gmagick::resizeimage — 调整图像尺寸
- Gmagick::rollimage — 偏移图像
- Gmagick::rotateimage — 旋转图片
- Gmagick::scaleimage — 调整图片大小
- Gmagick::separateimagechannel — Separates a channel from the image
- Gmagick::setfilename — 在读取或者写入图片之前设置文件名
- Gmagick::setimagebackgroundcolor — 设置图像背景色
- Gmagick::setimageblueprimary — Sets the image chromaticity blue primary point.
- Gmagick::setimagebordercolor — 设置图像边框颜色.
- Gmagick::setimagechanneldepth — Sets the depth of a particular image channel
- Gmagick::setimagecolorspace — Sets the image colorspace
- Gmagick::setimagecompose — Sets the image composite operator
- Gmagick::setimagedelay — Sets the image delay
- Gmagick::setimagedepth — Sets the image depth
- Gmagick::setimagedispose — Sets the image disposal method
- Gmagick::setimagefilename — 在一个序列中设置特定图片的文件名
- Gmagick::setimageformat — Sets the format of a particular image
- Gmagick::setimagegamma — Sets the image gamma
- Gmagick::setimagegreenprimary — TSets the image chromaticity green primary point.
- Gmagick::setimageindex — Set the iterator to the position in the image list specified with the index parameter
- Gmagick::setimageinterlacescheme — Sets the interlace scheme of the image.
- Gmagick::setimageiterations — Sets the image iterations.
- Gmagick::setimageprofile — Adds a named profile to the Gmagick object
- Gmagick::setimageredprimary — Sets the image chromaticity red primary point.
- Gmagick::setimagerenderingintent — Sets the image rendering intent
- Gmagick::setimageresolution — Sets the image resolution
- Gmagick::setimagescene — 设置图片场景
- Gmagick::setimagetype — 设置图片类型
- Gmagick::setimageunits — Sets the image units of resolution.
- Gmagick::setimagewhitepoint — Sets the image chromaticity white point.
- Gmagick::setsamplingfactors — Sets the image sampling factors.
- Gmagick::setsize — Sets the size of the Gmagick object
- Gmagick::shearimage — Creating a parallelogram
- Gmagick::solarizeimage — Applies a solarizing effect to the image
- Gmagick::spreadimage — Randomly displaces each pixel in a block
- Gmagick::stripimage — Strips an image of all profiles and comments
- Gmagick::swirlimage — Swirls the pixels about the center of the image
- Gmagick::thumbnailimage — Changes the size of an image
- Gmagick::trimimage — Remove edges from the image
- Gmagick::write — 将图片写入到指定文件名,如果文件名为空,则图片写入到Gmagick::ReadImage()或者Gmagick::SetImageFilename()设置的文件名中。
- Gmagick::writeimage — 将图片写入指定文件名,与Gmagick::write的区别在于writeimage函数包含一个可选的布尔参数all_frames。
2.GmagickDraw 类
- GmagickDraw::annotate — Draws text on the image
- GmagickDraw::arc — Draws an arc
- GmagickDraw::bezier — Draws a bezier curve
- GmagickDraw::ellipse — Draws an ellipse on the image
- GmagickDraw::getfillcolor — Returns the fill color
- GmagickDraw::getfillopacity — Returns the opacity used when drawing
- GmagickDraw::getfont — Returns the font
- GmagickDraw::getfontsize — Returns the font pointsize
- GmagickDraw::getfontstyle — Returns the font style
- GmagickDraw::getfontweight — Returns the font weight
- GmagickDraw::getstrokecolor — Returns the color used for stroking object outlines
- GmagickDraw::getstrokeopacity — Returns the opacity of stroked object outlines
- GmagickDraw::getstrokewidth — Returns the width of the stroke used to draw object outlines
- GmagickDraw::gettextdecoration — Returns the text decoration
- GmagickDraw::gettextencoding — Returns the code set used for text annotations
- GmagickDraw::line — The line purpose
- GmagickDraw::point — Draws a point
- GmagickDraw::polygon — Draws a polygon
- GmagickDraw::polyline — Draws a polyline
- GmagickDraw::rectangle — Draws a rectangle
- GmagickDraw::rotate — Applies the specified rotation to the current coordinate space
- GmagickDraw::roundrectangle — Draws a rounded rectangle
- GmagickDraw::scale — Adjusts the scaling factor
- GmagickDraw::setfillcolor — Sets the fill color to be used for drawing filled objects.
- GmagickDraw::setfillopacity — The setfillopacity purpose
- GmagickDraw::setfont — Sets the fully-specified font to use when annotating with text.
- GmagickDraw::setfontsize — Sets the font pointsize to use when annotating with text.
- GmagickDraw::setfontstyle — Sets the font style to use when annotating with text
- GmagickDraw::setfontweight — Sets the font weight
- GmagickDraw::setstrokecolor — Sets the color used for stroking object outlines.
- GmagickDraw::setstrokeopacity — Specifies the opacity of stroked object outlines.
- GmagickDraw::setstrokewidth — Sets the width of the stroke used to draw object outlines.
- GmagickDraw::settextdecoration — Specifies a decoration
- GmagickDraw::settextencoding — Specifies specifies the text code set
3.GmagickPixel 类
- GmagickPixel::__construct — The GmagickPixel constructor
- GmagickPixel::getcolor — Returns the color
- GmagickPixel::getcolorcount — Returns the color count associated with this color
- GmagickPixel::getcolorvalue — Gets the normalized value of the provided color channel
- GmagickPixel::setcolor — Sets the color
- GmagickPixel::setcolorvalue — Sets the normalized value of one of the channels
- 本文固定链接: https://zxbcw.cn/post/1090/
- 转载请注明:必须在正文中标注并保留原文链接
- QQ群: PHP高手阵营官方总群(344148542)
- QQ群: Yii2.0开发(304864863)