imageistruecolor

(PHP 4 >= 4.3.2, PHP 5, PHP 7)

imageistruecolor检查图像是否为真彩色图像

说明

imageistruecolor ( resource $image ) : bool

imageistruecolor() 检查 image 图像是否为真彩色图像。

参数

image

由图象创建函数(例如imagecreatetruecolor())返回的图象资源。

返回值

如果 image 是真彩色图像返回 TRUE,否则返回 FALSE

范例

Example #1 Simple detection of true color image instances using imageistruecolor()

<?php
// $im is an image instance

// Check if image is a true color image or not
if(!imageistruecolor($im))
{
    
// Create a new true color image instance
    
$tc imagecreatetruecolor(imagesx($im), imagesy($im));

    
imagecopy($tc$im0000imagesx($im), imagesy($im));
    
imagedestroy($im);

    
$im $tc;
    
$tc NULL;
}

// Continue working with image instance
?>

注释

Note: 此函数需要 GD 2.0.1 或更高版本(推荐 2.0.28 及更高版本)。

参见

相关文章
php gd 和图像处理 函数 取得图像类型的文件后缀php gd 和图像处理 函数 取得 getimagesize,exif read data,exif thumbnail,exif imagetype 所返回的图像类型的 mime 类型php gd 和图像处理 函数 以 wbmp 格式将图像输出到浏览器或文件php gd 和图像处理 函数 使一个图像中调色板版本的颜色与真彩色版本更能匹配php gd 和图像处理 函数 拷贝并合并图像的一部分php gd 和图像处理 函数 用灰度拷贝并合并图像的一部分php gd 和图像处理 函数 重采样拷贝部分图像并调整大小php gd 和图像处理 函数 拷贝部分图像并调整大小php gd 和图像处理 函数 新建一个真彩色图像php gd 和图像处理 函数 使用 freetype 2 字体将文本写入图像php gd 和图像处理 函数 对 gd 图像应用 gamma 修正php gd 和图像处理 函数 检查图像是否为真彩色图像php gd 和图像处理 函数 将调色板从一幅图像拷贝到另一幅php gd 和图像处理 函数 以 png 格式将图像输出到浏览器或文件php gd 和图像处理 函数 设定画线用的画笔图像php gd 和图像处理 函数 将真彩色图像转换为调色板图像php gd 和图像处理 函数 以 wbmp 格式将图像输出到浏览器或文件php gd 和图像处理 函数 将 webp 格式的图像输出到浏览器或文件php gd 和图像处理 函数 将 xbm 图像输出到浏览器或文件php gd 和图像处理 函数 将 png 图像文件转换为 wbmp 图像文件
关注编程学问公众号