Use PHP to convert JPEGs to transparent PNG
问题 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 right format. I also want to make their white backgrounds transparent. Does PHP have any functions I can use to achieve this? 回答1: After a few days of trying different solutions and doing some more research, this is what I found worked for me. $image = imagecreatefromjpeg( 'image.jpg' ); imagealphablending($image, true);