Posts

Showing posts with the label Wand

Easy 5 steps to get thumbnails out of Pdf using Python

1) Install Ghost script before python dependencies installation from: http://www.a-pdf.com/convert-to-pdf/gs.exe 2) Make yourself familier with Wand , a  ctypes -based simple  ImageMagick  binding for Python. 3) Install Wand - pip install wand 4) Use the following script.. #Install Ghost script before python package's installation #from: http://www.a-pdf.com/convert-to-pdf/gs.exe   from wand.image import Image from wand.display import display fileDirectory = "D:/files/" inFileName="myInputfile.pdf" outFileName="myOutputfile.png" imageFromPdf = Image(filename=fileDirectory+inFileName) pages = len(imageFromPdf.sequence) print(pages) image = Image( width=imageFromPdf.width, height=imageFromPdf.height * pages ) for i in range(pages): image.composite( imageFromPdf.sequence[i], top=imageFromPdf.height * i, left=0 ) image.format="png" image.save(filename=f...