Reputation: 23
I need to convert a .png file to .bmp; I'm using the outcome in printer_draw_bmp()
to print out a barcode.
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?
Upvotes: 1
Views: 6144
Reputation: 22386
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');
Or if you want to output image to http response:
$im = new Imagick('image.png');
$im->setImageFormat('bmp');
echo $im;
Upvotes: 2
Reputation: 501
There is a opensource project on Github that allows reading and saving of BMP files (and other file formats) in PHP.
The project is called PHP Image Magician.
Upvotes: 3