Use PHP to convert JPEGs to transparent PNG

前端 未结 4 1455
刺人心
刺人心 2020-12-15 01:31

I have a lot of JPEG images that I want to convert to PNG images using PHP. The JPEGs are going to be uploaded by clients so I can\'t trust them to make sure they are in the

4条回答
  •  无人及你
    2020-12-15 02:13

    This worked for me:

     $image = imagecreatefromjpeg( "image.jpg" );
     imagealphablending($image, true);
     imagepng($image, "image.png");
    

提交回复
热议问题