Snippets - GD
Change a png to a jpg - Anthony 14/6/2008
Any transparency is lost in this case as jpg does not support transparency. You can change from different formats by changing the imagecreatefrompng and the imagejpeg functions.
<?php// Create a new image in the memory from the file$png_image = imagecreatefrompng( "input.png" );// Save the image as output.jpgimagejpeg( $png_image, "output.jpg" );// Clear the memory of the tempory imageimagedestroy( $png_image );?>