1
我一直在努力将PDF转换为JPG,为此我安装了imagick和GhostScript。我一直在使用exec()在我的php代码中进行转换。现在我的问题是,如果输入pdf的来源是从doc-> pdf的转换,那么缩放时图像质量就会有颗粒感。在另一方面,我需要保持低于500KB的图像大小,所以我不能使用使用exec的imagick过滤器()
- 密度超过200
有没有办法保存图像之前添加任何类型的过滤器,使jpg质量得到改善。
这里是我的示例代码:
$inputFileName = 'test.pdf';
$outputFileName = 'converted.jpg';
$sourceFile = escapeshellarg($inputFileName);
$outputFile = escapeshellarg($outputFileName);
$exe = "convert -density 200 -colorspace RGB {$sourceFile } {$outputFile }";
$null = "0";
echo exec($exe, $null, $result);
任何帮助,将不胜感激!
感谢