Hi everyone, I am trying to convert and split a pdf to png in python using the following three lines:
Code: Select all
import Image, ImageOps
import subprocess, sys, os
filename = "99-005445-00043-039.pdf"
prefix = filename[filename.rfind('/') + 1:-4]
cmd = 'convert -density 600 -depth 8 -strip -background "#FFFFFF" -alpha off -colorspace "Gray" %s working/%s-%%d.png' % (filename, prefix)
subprocess.call([cmd], shell=True)
and I always get the following error even thought the conversion finishes successfully and the output is correct:
Code: Select all
Error: Ignoring invalid annotation, output may be incorrect.
I cannot figure out what it means or how to fix it. I do not really want to suppress it in case other errors are triggered. I tried removing certain options to see whether that triggers it. I suspect it might be the last part of the convert command
working/%s-%%d.png which instructs how the split images should be named.
Any help will be appreciated.