Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added DPI parameter to control PDF resolution. #53

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
change the pdf_images dpi
  • Loading branch information
Embracex1998 committed Sep 20, 2024
commit bf51dae0e034eee7717840f6a3d8f3e3e9dab041
2 changes: 1 addition & 1 deletion gptpdf/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def _parse_pdf_to_images(pdf_path: str,dpi:int,output_dir: str = './') -> List[T
page.draw_rect(text_rect, color=(1, 1, 1), fill=(1, 1, 1))
# 插入带有白色背景的文字
page.insert_text((text_x, text_y), name, fontsize=10, color=(1, 0, 0))
page_image_with_rects = page.get_pixmap(matrix=fitz.Matrix(3, 3))
page_image_with_rects = page.get_pixmap(matrix=fitz.Matrix(dpi/72, dpi/72))
page_image = os.path.join(output_dir, f'{page_index}.png')
page_image_with_rects.save(page_image)
image_infos.append((page_image, rect_images))
Expand Down