def pdf2jpeg(pdf_input_path, jpeg_output_path):
    args = ['pdf2jpeg', '-dNOPAUSE', '-sDEVICE=jpeg', '-r144', 
        '-sOutputFile=' + jpeg_output_path, pdf_input_path]
ghostscript.Ghostscript(*args)
Converting a PDF to a series of images with Python