使用 Imagick 和 Gmagick 调整大小后的图像文件大小
在调整图像大小时,我注意到 Imagick 和 Gmagick 使用相同的选项在 HDD 上生成具有不同文件大小的图像:
$image = new Imagick("c.jpg");
$image->thumbnailImage(260,195);
$image->writeImage("c_imagick.jpg");
输出 88kb 的图像
$image = new Gmagick("c.jpg");
$image->thumbnailImage(260,195);
$image->writeImage("c_gmagick.jpg");
输出 15kb 的图像
有人知道为什么差异如此之大吗?
While resizing an image, I have noticed that Imagick and Gmagick produce images with different filesize on HDD with the same options:
$image = new Imagick("c.jpg");
$image->thumbnailImage(260,195);
$image->writeImage("c_imagick.jpg");
outputs an Image with 88kb
$image = new Gmagick("c.jpg");
$image->thumbnailImage(260,195);
$image->writeImage("c_gmagick.jpg");
outputs an Image with 15kb
Does someone have any idea, why the difference is so huge?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试在调整大小之前设置图像压缩设置。
此外,检查生成图像的大小。 PHP 文档中的注释让我相信,thumbnailImage 的自动调整部分并不像您在 IMagick 中所期望的那样工作。
来自 PHP 文档:
Try setting the image compression settings prior to resizing.
Additionally, check the size of the resulting image. Comments in the PHP documentation lead me to believe that the automatic fit portion of thumbnailImage does not work as you would expect in IMagick.
From PHP Docs: