Convert GIF to JPG and JPG to GIF with PHP?
Moderator: General Moderators
- JAB Creations
- DevNet Resident
- Posts: 2341
- Joined: Thu Jan 13, 2005 6:44 pm
- Location: Sarasota Florida
- Contact:
Convert GIF to JPG and JPG to GIF with PHP?
I'd like to convert GIF and JPG image formats using PHP, what (if any) functions are available for me to do this? I've spotted jpeg2wbmp and png2wbmp but those don't seem to be what I want.
Re: Convert GIF to JPG and JPG to GIF with PHP?
research on the GD library classes of php, for graphics actually.. but there are a lot of generic classes of PHP which was written by programmers long ago that does conversion, resizing, etc. etc... you can download them at http://www.phpclasses.org although you need to register, and after registration make use of there search box for searching what you need.
- JAB Creations
- DevNet Resident
- Posts: 2341
- Joined: Thu Jan 13, 2005 6:44 pm
- Location: Sarasota Florida
- Contact:
Re: Convert GIF to JPG and JPG to GIF with PHP?
I've been to that site numerous times in the past...not seeing anything I need right now...GIF converter, conversion, "JPG to GIF", etc on the Google search. Most of the things that came up on Google were in regards to image editing applications, not PHP.
Re: Convert GIF to JPG and JPG to GIF with PHP?
If you have GD installed..
Gif to Jpeg:
Jpeg to Gif:
Don't expect fantastic results though. GIF and JPEG formats are designed for very different purposes, and an image in one format is never going to look very good in the other.
Gif to Jpeg:
Code: Select all
$image = imagecreatefromgif("image.gif");
imagejpeg($image);Code: Select all
$image = imagecreatefromjpeg("image.jpg");
imagetruecolortopalette($image);
imagegif($image);