使用PHP将.BMP转换为.PNG [英] Convert .BMP to .PNG with PHP
本文介绍了使用PHP将.BMP转换为.PNG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要能够将不同的图像格式转换为.PNG格式。在其他一些人的帮助下,我能够实现这一目标。唯一的问题是,我还需要能够在不使用ImageMagick的情况下将.BMP文件转换为.PNG。
I needed to be able to convert different image formats to the .PNG format. With the help of some others, I was able to make that happen. The only issue is, I also need to be able to convert .BMP files to .PNG without the use of ImageMagick.
这是我用过的代码其他文件的转换:
<?php
$filename = "myfolder/test.jpg";
$jpg = @imagecreatefromjpeg($filename);
if ($jpg)
{
header("Content-type: image/png");
imagepng($jpg);
imagedestroy($jpg);
exit;
}
?>
如果有人知道如何转换此信息,请告知我们。欢迎并欢迎所有帮助。
If anyone knows how I would go about converting this, please let me know. All help is welcome and appreciated.
推荐答案
Github上有一个新的开源项目,允许读取和保存BMP文件(和PHP中的其他文件格式。
There is a new opensource project on Github that allows reading and saving of BMP files (and other file formats) in PHP.
该项目名为 PHP Image Magician 。
这篇关于使用PHP将.BMP转换为.PNG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文