Convert jpg image to gif, png & bmp format using PHP

  • Added:
  • |
  • In: Basic PHP

How can I convert a single jpg image into 3 different image format gif , png and bmp using PHP?

Pls help

This Question Has 3 Answeres | Orginal Question | riad

I've set up a new opensource project on Github that allows reading and saving of BMP files (actual BMP files, not wbmp), and other file formats, in PHP. It's nice and easy to use.

The project is called PHP Image Magician.

You first create an image object out of your file with imagecreatefromjpeg(). You then dump that object into different formats (using imagegif() for example):

$imageObject = imagecreatefromjpeg($imageFile);
imagegif($imageObject, $imageFile . '.gif');
imagepng($imageObject, $imageFile . '.png');
imagewbmp($imageObject, $imageFile . '.bmp');

Meet with owner

Sajjad Hossain

Hey, I am Sajjad, working in web development sector since 2012. I love to do amazing things. Let's do a project together.
Connect Social With PHPAns