Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

get coordinates of an image from a pdf python

    import pdfplumber

    pdf_obj = pdfplumber.open(doc_path)
    page = pdf_obj.pages[page_no]
    images_in_page = page.images
    page_height = page.height
    image_bbox = (image['x0'], page_height - image['y1'], image['x1'], page_height - image['y0'])
    cropped_page = page.crop(image_bbox)
    image_obj = cropped_page.to_image(resolution=400)
    image_obj.save(path_to_save_image)



Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #coordinates #image #pdf #python
ADD COMMENT
Topic
Name
6+7 =