怎么用GD库把png格式的图片转为jpg的?

WBOY
Release: 2016-06-23 14:23:42
Original
1018 people have browsed it

基本需求是:把png的图片体积变小,然后保持一定的清晰度,尺寸不变。怎么实现?


回复讨论(解决方案)

$im = imagecreatefrompng('原图片名');
imagejpeg($im, '新图片名');

$im = imagecreatefrompng('原图片名');
imagejpeg($im, '新图片名'); imagejpeg($im, '新图片名'),第二个参数可以省略吗?我试了下,省略的话还是输出png格式的啊。

那是不可能的!

那是不可能的! 我试了,没转变格式,但体积变小了十倍,可是也变模糊了。求怎么保持清晰度?谢谢

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template