jpeg2wbmp()函數是PHP中的內置函數,用於將JPEG圖像文件轉換為WBMP圖像文件。
用法:
bool jpeg2wbmp( string $jpegname,
int $wbmpname, int $dest_height,
int $dest_width, int $threshold )
參數:該函數接受上述和以下所述的五個參數:
- $jpegname:它指定JPEG文件的路徑。
- $wbmpname:它指定目標WBMP文件的路徑。
- $dest_height:它指定目標圖像的高度。
- $dest_width:它指定目標圖像的寬度。
- $threshold:它指定閾值。
返回值:如果成功,則此函數返回TRUE;如果失敗,則返回FALSE。
下麵給出的程序說明了PHP中的jpeg2wbmp()函數:程序1:
<?php
// Path to the JPEG image which
// is to be converted
$path = './geeksforgeeks.jpg';
// Get the image sizes which includes
// the height and width
$image = getimagesize($path);
$height = $image[1];
$width = $image[0];
// Convert image the image and save as test.wbmp
jpeg2wbmp($path, './converted.wbmp', $height, $width, 5);
echo 'JPEG converted into WBMP successfully.';
?>
輸出:
This will save the WBMP version of JPEG in the same folder.
程序2:
<?php
// Path to the JPEG image which
// is to be converted
$path = './geeksforgeeks.jpg';
// Get the image sizes which includes
// the height and width
$image = getimagesize($path);
$height = $image[1];
$width = $image[0];
// Convert image the image and save as test.wbmp
jpeg2wbmp($path, './converted.wbmp', $height, $width, 1);
$im = imagecreatefromwbmp('./converted.wbmp');
header('Content-type:image/png');
imagepng($im);
?>
輸出:
參考: https://www.php.net/manual/en/function.jpeg2wbmp.php
相關用法
- p5.js pan()用法及代碼示例
- p5.js sin()用法及代碼示例
- d3.js d3.mean()用法及代碼示例
- d3.js d3.min()用法及代碼示例
- p5.js day()用法及代碼示例
- PHP Ds\Map get()用法及代碼示例
- PHP Ds\Map last()用法及代碼示例
- p5.js abs()用法及代碼示例
- d3.js d3.set.has()用法及代碼示例
- PHP min( )用法及代碼示例
- PHP max( )用法及代碼示例
- p5.js sq()用法及代碼示例
注:本文由純淨天空篩選整理自gurrrung大神的英文原創作品 PHP | jpeg2wbmp() function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。