gfx 从 pdf 创建低质量图像
我正在使用gfx这个工具,把PDF中的某一页转换成.png格式的图片,但生成的图片质量非常差。我必须使用gfx,不能用其他模块。下面是我用的代码:
import gfx
pdf_loc=”C:\new.pdf”
pagenumber=12
doc = gfx.open('pdf',pdf_loc)
page = doc.getPage(page_number)
img = gfx.ImageList()
img.setparameter("antialise", "1") # turn on antialising
img.startpage(page.width,page.height)
page.render(img)
img.endpage()
input_loc="C:\newimg.png"
img.save(input_loc)
2 个回答
0
加上这一行代码:
gfx.setparameter("zoom", "400")
想了解更多内容,可以查看这个链接:http://wiki.swftools.org/wiki/Python_gfx_tutorial
0
你可以使用 swfrender 这个工具。