imageinterlace

(PHP 4, PHP 5, PHP 7, PHP 8)

imageinterlace啟用或禁用隔行掃描

說明

imageinterlace(resource $image, int $interlace = 0): int

imageinterlace() 打開或關(guān)閉隔行掃描位(bit)。

如果設(shè)置了隔行掃描位(interlace bit),對(duì)于 JPEG 圖像,會(huì)被創(chuàng)建為漸進(jìn)式 JPEG 圖像。

參數(shù)

image

由圖象創(chuàng)建函數(shù)(例如imagecreatetruecolor())返回的 GdImage 對(duì)象。

interlace

如果為 0 ,則關(guān)閉隔行掃描,否則將打開隔行掃描。

返回值

如果為圖像設(shè)置了隔行掃描,則返回 1 ,否則返回 0 。

范例

示例 #1 使用 imageinterlace() 打開隔行掃描

<?php
// 創(chuàng)建一個(gè)圖像實(shí)例
$im imagecreatefromgif('php.gif');

// 打開隔行掃描
imageinterlace($imtrue);

// 保存圖像
imagegif($im'./php_interlaced.gif');
imagedestroy($im);
?>