2
我想使用ImageMagick將PDF轉換爲600 dpi和600 dpi的JPG格式以及96 dpi的Python腳本。將PDF轉換爲600dpi和JPG格式的TIFF 96 dpi
我做使用(ImageMagick的)命令行這項任務,但我想將PDF轉換爲TIFF和Python中使用ImageMagick的JPG,
可以請你幫我爲......
我想使用ImageMagick將PDF轉換爲600 dpi和600 dpi的JPG格式以及96 dpi的Python腳本。將PDF轉換爲600dpi和JPG格式的TIFF 96 dpi
我做使用(ImageMagick的)命令行這項任務,但我想將PDF轉換爲TIFF和Python中使用ImageMagick的JPG,
可以請你幫我爲......
可以使用subprocess module使用PythonMagick執行ImageMagick的命令
import subprocess
params = ['convert', "Options", 'pdf_file', 'thumb.jpg']
subprocess.check_call(params)
:
import PythonMagick
img = PythonMagick.Image()
img.density('600') # you have to set this here if the initial dpi are > 72
img.read('test.pdf') # the pdf is rendered at 600 dpi
img.write('test.tif')
img.density('96') # this has to be lower than the first dpi value (it was 600)
# img.resize('100x100') # size in px, just in case you need it
img.write('test.jpg')
但我只是想將pdf轉換爲使用imagemagick的tiff和jpg,而不是使用imagemagick的python接口(pythonmagick)... – user1977108 2013-02-14 09:56:30
所以我認爲Rakesh的答案就是你要找的:) – furins 2013-02-14 10:37:39