本文介绍了如何将.png文件转换为.bmp?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要将.png文件转换为.bmp;我正在 printer_draw_bmp()
中使用结果打印出条形码.
I need to convert a .png file to .bmp; I'm using the outcome in printer_draw_bmp()
to print out a barcode.
GD可以生成WBMP,但据我所知,它与.bmp不同.我该如何进行转换?还是有另一种直接打印.png的方法?
GD can generate WBMP, but as far as I can tell that's not the same as .bmp. How can I do this conversion? Or is there another way to print a .png directly?
推荐答案
AFAIK, GD 不支持bmp格式.但是您可以使用 ImageMagick 将文件保存为bmp格式:
AFAIK, GD doesn't support bmp format. But you can use ImageMagick to save file in bmp format:
$im = new Imagick('image.png');
$im->writeImage('image.bmp');
或者如果您要将图像输出到http响应:
Or if you want to output image to http response:
$im = new Imagick('image.png');
$im->setImageFormat('bmp');
echo $im;
这篇关于如何将.png文件转换为.bmp?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!