PHP: imagepng is creating inordinately large files

前端 未结 1 1997
南旧
南旧 2021-01-22 00:51

I\'m using a simple thumbnailing script I wrote and it\'s pretty standard:

$imgbuffer = imagecreatetruecolor($thumbwidth, $thumbheight);
switch($type) {
  case 1         


        
相关标签:
1条回答
  • 2021-01-22 01:13

    PNG is a lossless format and will not yield good compression ratios for photos and other complex images that are typically compressed in JPEG files.

    To make things worse, if you're converting JPEG files to PNG, the PNG will also have to reproduce pixel-for-pixel the compression artifacts caused by the JPEG lossy compression.

    Use PNG only for computer graphics and other images that are highly compressible or when you absolutely cannot lose any data (or, as Kris correctly pointed, when you need an alpha channel).

    0 讨论(0)
提交回复
热议问题