开发者

convert pdf to image with imageMagick

Any Idea what I am doing wrong here? The convert never seems to even open the pdf:

a = r"\\server\gis\agsResources\resources\map4.pdf"
b = r"\\server\gis\agsResources\resources\map4.png"
boutput = Popen([
    r'C:\Program Files\ImageMagick-6.7.0-Q16\convert.exe',
   '-density=400',
   '-scale=2000x1000',
   '-sOutputFile=%s' % (b),
    '%s' %(a),

],s开发者_JAVA技巧tdout=PIPE,stderr = STDOUT).communicate()[0]


The option syntax does not look right. When I try your code (with just paths changed), convert: unrecognized option '-density=400' is written to the boutput variable.

This works for me:

boutput = Popen([
    '/bin/convert',
    '-density', '400',
    '-scale', '2000x1000',
    '%s' % a,
    '%s' % b 
], stdout=PIPE, stderr=STDOUT).communicate()[0]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜