Как извлечь графики и диаграммы из PDF с помощью модуля Python и Fitz? ⇐ Python
-
Anonymous
Как извлечь графики и диаграммы из PDF с помощью модуля Python и Fitz?
I want to extract graphs and charts from PDF, that are not visible when using typical image extraction from module fitz. I've noticed that all of them are in a frame, so they should be not that hard to find. I also don't want to extract data from them. What i really want is to find them and just save them as PNG file.enter image description here
What i've tried is using get_image_bbox() function, but there is not much info about that in documentation and I did not use that correctly. Is there any other option how to do that? In this part I also don't want to extract tables. Only pie charts, bar charts and things like that.
import fitz def extract_drawings_from_pdf(pdf_file): drawings_per_page = [] with fitz.open(pdf_file) as pdf: for index, page in enumerate(pdf): page = pdf.load_page(index) drawings = page.get_image_bbox(page[index]) drawings_per_page.append(drawings) return drawings_per_page
Источник: https://stackoverflow.com/questions/780 ... itz-module
I want to extract graphs and charts from PDF, that are not visible when using typical image extraction from module fitz. I've noticed that all of them are in a frame, so they should be not that hard to find. I also don't want to extract data from them. What i really want is to find them and just save them as PNG file.enter image description here
What i've tried is using get_image_bbox() function, but there is not much info about that in documentation and I did not use that correctly. Is there any other option how to do that? In this part I also don't want to extract tables. Only pie charts, bar charts and things like that.
import fitz def extract_drawings_from_pdf(pdf_file): drawings_per_page = [] with fitz.open(pdf_file) as pdf: for index, page in enumerate(pdf): page = pdf.load_page(index) drawings = page.get_image_bbox(page[index]) drawings_per_page.append(drawings) return drawings_per_page
Источник: https://stackoverflow.com/questions/780 ... itz-module