jpeg2wbmp
將JPEG圖像文件轉換為WBMP圖像文件
函數名稱:jpeg2wbmp()
適用版本:PHP 4 >= 4.0.5, PHP 5, PHP 7
函數描述:將JPEG圖像轉換為WBMP圖像
用法:
bool jpeg2wbmp(string $jpegname, string $wbmpname, int $dest_height, int $dest_width, int $threshold)
參數:
$jpegname
:JPEG圖像文件的路徑和文件名。$wbmpname
:轉換後的WBMP圖像文件的路徑和文件名。$dest_height
:轉換後的WBMP圖像的高度。$dest_width
:轉換後的WBMP圖像的寬度。$threshold
:可選參數,表示用於二值化圖像的閾值。默認值為80。返回值:
示例:
$jpegname = 'path/to/image.jpg'; $wbmpname = 'path/to/image.wbmp'; $dest_height = 200; $dest_width = 200; $threshold = 80; if (jpeg2wbmp($jpegname, $wbmpname, $dest_height, $dest_width, $threshold)) { echo 'JPEG image converted to WBMP successfully.'; } else { echo 'Failed to convert JPEG image to WBMP.'; }
上述示例將指定的JPEG圖像轉換為200x200像素的WBMP圖像,並將閾值設置為80。如果轉換成功,則輸出"JPEG image converted to WBMP successfully.",否則輸出"Failed to convert JPEG image to WBMP."