jpeg2wbmp
Convert JPEG image file to WBMP image file
Function name: jpeg2wbmp()
Applicable version: PHP 4 >= 4.0.5, PHP 5, PHP 7
Function Description: Convert JPEG image to WBMP image
usage:
bool jpeg2wbmp(string $jpegname, string $wbmpname, int $dest_height, int $dest_width, int $threshold)
parameter:
$jpegname
: The path and file name of the JPEG image file.$wbmpname
: The path and file name of the converted WBMP image file.$dest_height
: The height of the converted WBMP image.$dest_width
: The width of the converted WBMP image.$threshold
: Optional parameter, indicating the threshold value used for binarized images. The default value is 80.Return value:
Example:
$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.'; }
The above example converts the specified JPEG image into a WBMP image of 200x200 pixels and sets the threshold to 80. If the conversion is successful, output "JPEG image converted to WBMP successfully." Otherwise, output "Failed to convert JPEG image to WBMP."