首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

imageistruecolor

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

imageistruecolor - 查找图像是否为真彩图像

描述

代码语言:javascript
复制
bool imageistruecolor ( resource $image )

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

参数

代码语言:txt
复制
`image`   

一个图像资源,由图像创建函数之一返回,如imagecreatetruecolor()。

返回值

返回TRUEim如果age是truecolor FALSE则返回,。

例子

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

代码语言:javascript
复制
<?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));

    // Copy over the pixels
    imagecopy($tc, $im, 0, 0, 0, 0, imagesx($im), imagesy($im));
    imagedestroy($im);

    $im = $tc;
    $tc = NULL;

    // OR use imagepalettetotruecolor()
}

// Continue working with image instance
?>

← imageinterlace

imagejpeg →

扫码关注腾讯云开发者

领取腾讯云代金券