开发者

convert pdf to image with imageMagick

开发者 https://www.devze.com 2023-03-18 20:49 出处:网络
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\"

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

精彩评论

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

关注公众号