ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、视频、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# GD(内置) 要激活 GD 支持,配置 PHP 时加上\*\*--with-gd\[=DIR\]**,DIR 是 GD 的基本安装目录。要使用推荐的绑定的 GD 库版本(首次绑定于 PHP 4.3.0),使用**--with-gd\*\*。要编译 GD 库,需要libpng和libjpeg。 windows启用php\_gd2.dll 要想在 PHP 中使用图像处理功能,你需要连带GD库一起来编译 PHP。GD库和 PHP 可能需要其他的库, 这取决于你要处理的图像格式 - [范例](https://www.php.net/manual/zh/image.examples.php) - [使用 PHP 创建 PNG 图像](https://www.php.net/manual/zh/image.examples-png.php) - [使用 Alpha 通道为图像加水印](https://www.php.net/manual/zh/image.examples-watermark.php) - [使用 imagecopymerge 函数创建半透明水印](https://www.php.net/manual/zh/image.examples.merged-watermark.php) - [GD 和图像处理 函数](https://www.php.net/manual/zh/ref.image.php) - [gd\_info](https://www.php.net/manual/zh/function.gd-info.php)— 取得当前安装的 GD 库的信息 - [getimagesize](https://www.php.net/manual/zh/function.getimagesize.php)— 取得图像大小 - [getimagesizefromstring](https://www.php.net/manual/zh/function.getimagesizefromstring.php)— 从字符串中获取图像尺寸信息 - [image\_type\_to\_extension](https://www.php.net/manual/zh/function.image-type-to-extension.php)— 取得图像类型的文件后缀 - [image\_type\_to\_mime\_type](https://www.php.net/manual/zh/function.image-type-to-mime-type.php)— 取得 getimagesize,exif\_read\_data,exif\_thumbnail,exif\_imagetype 所返回的图像类型的 MIME 类型 - [image2wbmp](https://www.php.net/manual/zh/function.image2wbmp.php)— 以 WBMP 格式将图像输出到浏览器或文件 - [imageaffine](https://www.php.net/manual/zh/function.imageaffine.php)— 返回经过仿射变换后的图像,剪切区域可选 - [imageaffinematrixconcat](https://www.php.net/manual/zh/function.imageaffinematrixconcat.php)— Concatenate two affine transformation matrices - [imageaffinematrixget](https://www.php.net/manual/zh/function.imageaffinematrixget.php)— Get an affine transformation matrix - [imagealphablending](https://www.php.net/manual/zh/function.imagealphablending.php)— 设定图像的混色模式 - [imageantialias](https://www.php.net/manual/zh/function.imageantialias.php)— 是否使用抗锯齿(antialias)功能 - [imagearc](https://www.php.net/manual/zh/function.imagearc.php)— 画椭圆弧 - [imagebmp](https://www.php.net/manual/zh/function.imagebmp.php)— Output a BMP image to browser or file - [imagechar](https://www.php.net/manual/zh/function.imagechar.php)— 水平地画一个字符 - [imagecharup](https://www.php.net/manual/zh/function.imagecharup.php)— 垂直地画一个字符 - [imagecolorallocate](https://www.php.net/manual/zh/function.imagecolorallocate.php)— 为一幅图像分配颜色 - [imagecolorallocatealpha](https://www.php.net/manual/zh/function.imagecolorallocatealpha.php)— 为一幅图像分配颜色 + alpha - [imagecolorat](https://www.php.net/manual/zh/function.imagecolorat.php)— 取得某像素的颜色索引值 - [imagecolorclosest](https://www.php.net/manual/zh/function.imagecolorclosest.php)— 取得与指定的颜色最接近的颜色的索引值 - [imagecolorclosestalpha](https://www.php.net/manual/zh/function.imagecolorclosestalpha.php)— 取得与指定的颜色加透明度最接近的颜色 - [imagecolorclosesthwb](https://www.php.net/manual/zh/function.imagecolorclosesthwb.php)— 取得与给定颜色最接近的色度的黑白色的索引 - [imagecolordeallocate](https://www.php.net/manual/zh/function.imagecolordeallocate.php)— 取消图像颜色的分配 - [imagecolorexact](https://www.php.net/manual/zh/function.imagecolorexact.php)— 取得指定颜色的索引值 - [imagecolorexactalpha](https://www.php.net/manual/zh/function.imagecolorexactalpha.php)— 取得指定的颜色加透明度的索引值 - [imagecolormatch](https://www.php.net/manual/zh/function.imagecolormatch.php)— 使一个图像中调色板版本的颜色与真彩色版本更能匹配 - [imagecolorresolve](https://www.php.net/manual/zh/function.imagecolorresolve.php)— 取得指定颜色的索引值或有可能得到的最接近的替代值 - [imagecolorresolvealpha](https://www.php.net/manual/zh/function.imagecolorresolvealpha.php)— 取得指定颜色 + alpha 的索引值或有可能得到的最接近的替代值 - [imagecolorset](https://www.php.net/manual/zh/function.imagecolorset.php)— 给指定调色板索引设定颜色 - [imagecolorsforindex](https://www.php.net/manual/zh/function.imagecolorsforindex.php)— 取得某索引的颜色 - [imagecolorstotal](https://www.php.net/manual/zh/function.imagecolorstotal.php)— 取得一幅图像的调色板中颜色的数目 - [imagecolortransparent](https://www.php.net/manual/zh/function.imagecolortransparent.php)— 将某个颜色定义为透明色 - [imageconvolution](https://www.php.net/manual/zh/function.imageconvolution.php)— 用系数 div 和 offset 申请一个 3x3 的卷积矩阵 - [imagecopy](https://www.php.net/manual/zh/function.imagecopy.php)— 拷贝图像的一部分 - [imagecopymerge](https://www.php.net/manual/zh/function.imagecopymerge.php)— 拷贝并合并图像的一部分 - [imagecopymergegray](https://www.php.net/manual/zh/function.imagecopymergegray.php)— 用灰度拷贝并合并图像的一部分 - [imagecopyresampled](https://www.php.net/manual/zh/function.imagecopyresampled.php)— 重采样拷贝部分图像并调整大小 - [imagecopyresized](https://www.php.net/manual/zh/function.imagecopyresized.php)— 拷贝部分图像并调整大小 - [imagecreate](https://www.php.net/manual/zh/function.imagecreate.php)— 新建一个基于调色板的图像 - [imagecreatefrombmp](https://www.php.net/manual/zh/function.imagecreatefrombmp.php)— 由文件或 URL 创建一个新图象。 - [imagecreatefromgd2](https://www.php.net/manual/zh/function.imagecreatefromgd2.php)— 从 GD2 文件或 URL 新建一图像 - [imagecreatefromgd2part](https://www.php.net/manual/zh/function.imagecreatefromgd2part.php)— 从给定的 GD2 文件或 URL 中的部分新建一图像 - [imagecreatefromgd](https://www.php.net/manual/zh/function.imagecreatefromgd.php)— 从 GD 文件或 URL 新建一图像 - [imagecreatefromgif](https://www.php.net/manual/zh/function.imagecreatefromgif.php)— 由文件或 URL 创建一个新图象。 - [imagecreatefromjpeg](https://www.php.net/manual/zh/function.imagecreatefromjpeg.php)— 由文件或 URL 创建一个新图象。 - [imagecreatefrompng](https://www.php.net/manual/zh/function.imagecreatefrompng.php)— 由文件或 URL 创建一个新图象。 - [imagecreatefromstring](https://www.php.net/manual/zh/function.imagecreatefromstring.php)— 从字符串中的图像流新建一图像 - [imagecreatefromwbmp](https://www.php.net/manual/zh/function.imagecreatefromwbmp.php)— 由文件或 URL 创建一个新图象。 - [imagecreatefromwebp](https://www.php.net/manual/zh/function.imagecreatefromwebp.php)— 由文件或 URL 创建一个新图象。 - [imagecreatefromxbm](https://www.php.net/manual/zh/function.imagecreatefromxbm.php)— 由文件或 URL 创建一个新图象。 - [imagecreatefromxpm](https://www.php.net/manual/zh/function.imagecreatefromxpm.php)— 由文件或 URL 创建一个新图象。 - [imagecreatetruecolor](https://www.php.net/manual/zh/function.imagecreatetruecolor.php)— 新建一个真彩色图像 - [imagecrop](https://www.php.net/manual/zh/function.imagecrop.php)— Crop an image to the given rectangle - [imagecropauto](https://www.php.net/manual/zh/function.imagecropauto.php)— Crop an image automatically using one of the available modes - [imagedashedline](https://www.php.net/manual/zh/function.imagedashedline.php)— 画一虚线 - [imagedestroy](https://www.php.net/manual/zh/function.imagedestroy.php)— 销毁一图像 - [imageellipse](https://www.php.net/manual/zh/function.imageellipse.php)— 画一个椭圆 - [imagefill](https://www.php.net/manual/zh/function.imagefill.php)— 区域填充 - [imagefilledarc](https://www.php.net/manual/zh/function.imagefilledarc.php)— 画一椭圆弧且填充 - [imagefilledellipse](https://www.php.net/manual/zh/function.imagefilledellipse.php)— 画一椭圆并填充 - [imagefilledpolygon](https://www.php.net/manual/zh/function.imagefilledpolygon.php)— 画一多边形并填充 - [imagefilledrectangle](https://www.php.net/manual/zh/function.imagefilledrectangle.php)— 画一矩形并填充 - [imagefilltoborder](https://www.php.net/manual/zh/function.imagefilltoborder.php)— 区域填充到指定颜色的边界为止 - [imagefilter](https://www.php.net/manual/zh/function.imagefilter.php)— 对图像使用过滤器 - [imageflip](https://www.php.net/manual/zh/function.imageflip.php)— Flips an image using a given mode - [imagefontheight](https://www.php.net/manual/zh/function.imagefontheight.php)— 取得字体高度 - [imagefontwidth](https://www.php.net/manual/zh/function.imagefontwidth.php)— 取得字体宽度 - [imageftbbox](https://www.php.net/manual/zh/function.imageftbbox.php)— 给出一个使用 FreeType 2 字体的文本框 - [imagefttext](https://www.php.net/manual/zh/function.imagefttext.php)— 使用 FreeType 2 字体将文本写入图像 - [imagegammacorrect](https://www.php.net/manual/zh/function.imagegammacorrect.php)— 对 GD 图像应用 gamma 修正 - [imagegd2](https://www.php.net/manual/zh/function.imagegd2.php)— 将 GD2 图像输出到浏览器或文件 - [imagegd](https://www.php.net/manual/zh/function.imagegd.php)— 将 GD 图像输出到浏览器或文件 - [imagegetclip](https://www.php.net/manual/zh/function.imagegetclip.php)— Get the clipping rectangle - [imagegif](https://www.php.net/manual/zh/function.imagegif.php)— 输出图象到浏览器或文件。 - [imagegrabscreen](https://www.php.net/manual/zh/function.imagegrabscreen.php)— Captures the whole screen - [imagegrabwindow](https://www.php.net/manual/zh/function.imagegrabwindow.php)— Captures a window - [imageinterlace](https://www.php.net/manual/zh/function.imageinterlace.php)— 激活或禁止隔行扫描 - [imageistruecolor](https://www.php.net/manual/zh/function.imageistruecolor.php)— 检查图像是否为真彩色图像 - [imagejpeg](https://www.php.net/manual/zh/function.imagejpeg.php)— 输出图象到浏览器或文件。 - [imagelayereffect](https://www.php.net/manual/zh/function.imagelayereffect.php)— 设定 alpha 混色标志以使用绑定的 libgd 分层效果 - [imageline](https://www.php.net/manual/zh/function.imageline.php)— 画一条线段 - [imageloadfont](https://www.php.net/manual/zh/function.imageloadfont.php)— 载入一新字体 - [imageopenpolygon](https://www.php.net/manual/zh/function.imageopenpolygon.php)— Draws an open polygon - [imagepalettecopy](https://www.php.net/manual/zh/function.imagepalettecopy.php)— 将调色板从一幅图像拷贝到另一幅 - [imagepalettetotruecolor](https://www.php.net/manual/zh/function.imagepalettetotruecolor.php)— Converts a palette based image to true color - [imagepng](https://www.php.net/manual/zh/function.imagepng.php)— 以 PNG 格式将图像输出到浏览器或文件 - [imagepolygon](https://www.php.net/manual/zh/function.imagepolygon.php)— 画一个多边形 - [imagepsbbox](https://www.php.net/manual/zh/function.imagepsbbox.php)— 给出一个使用 PostScript Type1 字体的文本方框 - [imagepsencodefont](https://www.php.net/manual/zh/function.imagepsencodefont.php)— 改变字体中的字符编码矢量 - [imagepsextendfont](https://www.php.net/manual/zh/function.imagepsextendfont.php)— 扩充或精简字体 - [imagepsfreefont](https://www.php.net/manual/zh/function.imagepsfreefont.php)— 释放一个 PostScript Type 1 字体所占用的内存 - [imagepsloadfont](https://www.php.net/manual/zh/function.imagepsloadfont.php)— 从文件中加载一个 PostScript Type 1 字体 - [imagepsslantfont](https://www.php.net/manual/zh/function.imagepsslantfont.php)— 倾斜某字体 - [imagepstext](https://www.php.net/manual/zh/function.imagepstext.php)— 用 PostScript Type1 字体把文本字符串画在图像上 - [imagerectangle](https://www.php.net/manual/zh/function.imagerectangle.php)— 画一个矩形 - [imageresolution](https://www.php.net/manual/zh/function.imageresolution.php)— Get or set the resolution of the image - [imagerotate](https://www.php.net/manual/zh/function.imagerotate.php)— 用给定角度旋转图像 - [imagesavealpha](https://www.php.net/manual/zh/function.imagesavealpha.php)— 设置标记以在保存 PNG 图像时保存完整的 alpha 通道信息(与单一透明色相反) - [imagescale](https://www.php.net/manual/zh/function.imagescale.php)— Scale an image using the given new width and height - [imagesetbrush](https://www.php.net/manual/zh/function.imagesetbrush.php)— 设定画线用的画笔图像 - [imagesetclip](https://www.php.net/manual/zh/function.imagesetclip.php)— Set the clipping rectangle - [imagesetinterpolation](https://www.php.net/manual/zh/function.imagesetinterpolation.php)— Set the interpolation method - [imagesetpixel](https://www.php.net/manual/zh/function.imagesetpixel.php)— 画一个单一像素 - [imagesetstyle](https://www.php.net/manual/zh/function.imagesetstyle.php)— 设定画线的风格 - [imagesetthickness](https://www.php.net/manual/zh/function.imagesetthickness.php)— 设定画线的宽度 - [imagesettile](https://www.php.net/manual/zh/function.imagesettile.php)— 设定用于填充的贴图 - [imagestring](https://www.php.net/manual/zh/function.imagestring.php)— 水平地画一行字符串 - [imagestringup](https://www.php.net/manual/zh/function.imagestringup.php)— 垂直地画一行字符串 - [imagesx](https://www.php.net/manual/zh/function.imagesx.php)— 取得图像宽度 - [imagesy](https://www.php.net/manual/zh/function.imagesy.php)— 取得图像高度 - [imagetruecolortopalette](https://www.php.net/manual/zh/function.imagetruecolortopalette.php)— 将真彩色图像转换为调色板图像 - [imagettfbbox](https://www.php.net/manual/zh/function.imagettfbbox.php)— 取得使用 TrueType 字体的文本的范围 - [imagettftext](https://www.php.net/manual/zh/function.imagettftext.php)— 用 TrueType 字体向图像写入文本 - [imagetypes](https://www.php.net/manual/zh/function.imagetypes.php)— 返回当前 PHP 版本所支持的图像类型 - [imagewbmp](https://www.php.net/manual/zh/function.imagewbmp.php)— 以 WBMP 格式将图像输出到浏览器或文件 - [imagewebp](https://www.php.net/manual/zh/function.imagewebp.php)— 将 WebP 格式的图像输出到浏览器或文件 - [imagexbm](https://www.php.net/manual/zh/function.imagexbm.php)— 将 XBM 图像输出到浏览器或文件 - [iptcembed](https://www.php.net/manual/zh/function.iptcembed.php)— 将二进制 IPTC 数据嵌入到一幅 JPEG 图像中 - [iptcparse](https://www.php.net/manual/zh/function.iptcparse.php)— 将二进制 IPTC 块解析为单个标记 - [jpeg2wbmp](https://www.php.net/manual/zh/function.jpeg2wbmp.php)— 将 JPEG 图像文件转换为 WBMP 图像文件 - [png2wbmp](https://www.php.net/manual/zh/function.png2wbmp.php)— 将 PNG 图像文件转换为 WBMP 图像文件