PHP uses GD library to generate images in BMP format (imagebmp)
Source: Internet
Author: User
/ **
* Create bmp format picture
*
* @author: legend
* @description: create Bitmap-File with GD library
* @version: 0.1
*
* @param resource $ im image resource
* @param string $ filename If you want to save as a file, please specify the file name, if it is empty, it will be directly output in the browser
* @param integer $ bit image quality (1, 4, 8, 16, 24, 32 bits)
* @param integer $ compression compression method, 0 is not compressed, 1 is compressed using RLE8 compression algorithm
*
* @return integer
* /
function imagebmp (& $ im, $ filename = ”, $ bit = 8, $ compression = 0)
{
if (! in_array ($ bit, array (1, 4, 8, 16, 24, 32)))
{
$ bit = 8;
}
else if ($ bit == 32) // todo: 32 bit
{
$ bit = 24;
}
$ bits = pow (2, $ bit);
$ size_data = strlen ($ bmp_data);
}
else
{
// The number of bytes in each line must be a multiple of 4, which is complemented.
$ extra = ”;
$ padding = 4 – ($ width * ($ bit / 8))% 4;
if ($ padding% 4! = 0)
{
$ extra = str_repeat (“\ 0 ″, $ padding);
}
// bitmap data
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.