Vol*_*erK 7

创建一个与源图像具有相同尺寸的新真彩色图像资源(t),然后(s)复制到(t).

例如(没有错误处理):

$imgSource = imagecreatefromgif('xyz.gif');
$width = imagesx($imgSource);
$height = imagesy($imgSource);
$imgTC = imagecreatetruecolor($width, $height);
imagecopy($imgTC, $imgSource, 0, 0, 0, 0, $width, $height);
// save or send $imgTC
Run Code Online (Sandbox Code Playgroud)

您将在内存中以gd2格式存储这两个图像(每个像素4个字节?5?),因此在使用较大的图像尝试此操作之前,最好先检查memory_limit设置.