PHP Imagick PDF conversion Text aliasing

送分小仙女□ 提交于 2019-11-28 02:24:49

Image Magick uses Ghostscript to actually render PDFs, and I think you are using a version of Ghostscript that has a bug in it, that causes text not to be anti-aliased correctly.

I tested the code you provided, as well as with a direct invocation of Ghostscript with the command.

gs -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=1 -sDEVICE=pngalpha -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r150  -sOutputFile=foo-%d.png flyer.pdf

By default, my Centos box was using Ghostscript version 8.70 which shows the issue you're seeing, both when invoked from Imagick and from the gs command above. Downloading version 9.14 from here makes the text be anti-aliased correctly when using the command-line, and probably would when invoked via Imagick.

It is not a problem with anti-aliasing most likely.

Increase your resolution up to 400 and see what happens.

$imagick->setResolution(400,400);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!