Skip to content

Instantly share code, notes, and snippets.

@thequbit
Created September 2, 2014 02:03
Show Gist options
  • Save thequbit/b76ef1153a7e308f6b9b to your computer and use it in GitHub Desktop.
Save thequbit/b76ef1153a7e308f6b9b to your computer and use it in GitHub Desktop.
from wand.image import Image as WandImage
import sys
if __name__ == '__main__':
print "Welcome to wand-text.py!"
if len(sys.argv) != 3:
print "Usage:\n\n\tpython wand-text.py <input_pdf_filename> <output_image_filename>"
else:
pdf_filename = sys.argv[1]
image_filename = sys.argv[2]
try:
#if True:
img = WandImage(filename=pdf_filename, resolution=400)
#img.compression_quality = 99
img.save(filename=image_filename)
except Exception, e:
print "ERROR: {0}".format(e)
print "Exit."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment