(PHP 4 >= 4.3.2, PHP 5, PHP 7, PHP 8)
imageistruecolor — 画像が truecolor かどうか調べる
image
imagecreatetruecolor()のような画像作成関数が返す GdImage オブジェクト。
例1 imageistruecolor() による、シンプルな true color 画像の検出
<?php
// $im は画像のインスタンスです
// それが true color 画像か否かを調べます
if(!imageistruecolor($im))
{
// 新しい true color 画像のインスタンスを作成します
$tc = imagecreatetruecolor(imagesx($im), imagesy($im));
// ピクセルをコピーします
imagecopy($tc, $im, 0, 0, 0, 0, imagesx($im), imagesy($im));
imagedestroy($im);
$im = $tc;
$tc = NULL;
// あるいは imagepalettetotruecolor() を使います
}
// 画像のインスタンスに対する操作を続けます
?>