使用 imagemagick 设置质量?
我使用以下代码在网站上创建缩略图:
$small_image = new Imagick($large_path."/".$pic['image']);
$small_image->thumbnailImage(100, 0);
$small_image->writeImage($small_path."/".$pic['image']);
它设置了它自己的质量,我尝试添加
$small_image->setCompression(imagick::COMPRESSION_JPEG);
$small_image->setCompressionQuality(1);
但这并没有改变任何事情。我也尝试过,
$img = new Imagick($small_path."/".$pic['image']);
$img->setCompression(Imagick::COMPRESSION_JPEG);
echo $img->setCompressionQuality(1); // should come out ugly
$img->writeImage();
但即使这样也没有改变尺寸和质量 1.你知道我做错了什么吗?
I use the following code to create a thumbnail on the site:
$small_image = new Imagick($large_path."/".$pic['image']);
$small_image->thumbnailImage(100, 0);
$small_image->writeImage($small_path."/".$pic['image']);
It sets it's own quality and I tried adding
$small_image->setCompression(imagick::COMPRESSION_JPEG);
$small_image->setCompressionQuality(1);
But that didn't change a thing. I also tried
$img = new Imagick($small_path."/".$pic['image']);
$img->setCompression(Imagick::COMPRESSION_JPEG);
echo $img->setCompressionQuality(1); // should come out ugly
$img->writeImage();
But even that didn't change the size with quality 1. Any ideas what I'm doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想你想要:
注意“获取”/“设置”和“压缩”之间的“图像”。
I think you want:
Note the "Image" between the "get"/"set" and "Compression".