我试图将PDF转换为图像文件(PNG,JPG,GIF无所谓)。PDF 2使用PHP的图像没有质量损失?
但是,使用下面的代码:
<?php
$im = new imagick('helloworld.pdf[0]');
$im->setImageFormat('png');
header('Content-Type: image/png');
echo $im;
?>
图片质量显著下降。
有什么方法可以将它转换为没有或很少质量损失?
我试图将PDF转换为图像文件(PNG,JPG,GIF无所谓)。PDF 2使用PHP的图像没有质量损失?
但是,使用下面的代码:
<?php
$im = new imagick('helloworld.pdf[0]');
$im->setImageFormat('png');
header('Content-Type: image/png');
echo $im;
?>
图片质量显著下降。
有什么方法可以将它转换为没有或很少质量损失?
你有Imagick::setCompression,Imagick::setCompressionQuality和Imagick::setImageCompression
为this家伙帮助
$im->setImageCompression(\Imagick::COMPRESSION_UNDEFINED);
$im->setImageCompressionQuality(0);
无论如何,你必须把一些这方面的字符串格式化的图像为PNG
如果你在[so]找到类似问题的解决方案, ,而不是复制它,将问题标记为[重复](http://meta.stackexchange.com/q/10841/212576)。 – hjpotter92
@ hjpotter92不,我没有,这只是一个例子,别人如何使用这些功能。请注意,我链接到的答案不是一个解决方案 – vladkras
@ hjpotter92也请注意,另一个答案在[that](http://stackoverflow.com/a/12054887/1713660)tred([将多页PDF转换为PNG并返回(Linux)](http://stackoverflow.com/questions/9710118/convert-multipage-pdf-to-png-and-back-linux/12046542#12046542))再次指向stackoverflow,但它并没有downvoted,因为它可能是有用的(只是想一想) – vladkras
可能之前玩复制[PHP + Imagick - PNG压缩](http://stackoverflow.com/questions/7462827/phpimagick-png-compression) – JimL
可能的重复[转换多页PDF到P NG和回(Linux)](http://stackoverflow.com/questions/9710118/convert-multipage-pdf-to-png-and-back-linux) – hjpotter92