def pdf2tiff(pdfPath, pageNum=0, resolution=72.0):
    "Convert one page of a PDF to TIFF at a specific res. in DPI."

    tiffPath = "%s-%d.tiff" % (splitext(pdfPath)[0], pageNum)
    pdfData = NSData.dataWithContentsOfFile_(pdfPath)
    pdfRep = NSPDFImageRep.imageRepWithData_(pdfData)
    pageCount = pdfRep.pageCount()
    if pageNum > pageCount-1: return
    pdfRep.setCurrentPage_(pageNum)
    pdfImage = NSImage.alloc().init()
    pdfImage.addRepresentation_(pdfRep)
    originalSize = pdfImage.size()
    width, height = originalSize
    pdfImage.setScalesWhenResized_(YES)
    rf = resolution / 72.0
    pdfImage.setSize_((width*rf, height*rf))
    tiffData = pdfImage.TIFFRepresentation()
    tiffData.writeToFile_atomically_(tiffPath, YES)
Convert one page of a PDF to TIFF at a specific res. in DPI.
recipes/Python/223320_Convert_PDF_to_TIFF_on_Mac_OS_X/recipe-223320.py