Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wangsen
MinerU
Commits
b53409ea
Unverified
Commit
b53409ea
authored
Nov 26, 2024
by
Xiaomeng Zhao
Committed by
GitHub
Nov 26, 2024
Browse files
Merge pull request #1106 from myhloli/dev
perf(image_processing): reduce maximum image size for analysis
parents
eb6d5dc8
b3644157
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
magic_pdf/model/doc_analyze_by_custom_model.py
magic_pdf/model/doc_analyze_by_custom_model.py
+2
-2
No files found.
magic_pdf/model/doc_analyze_by_custom_model.py
View file @
b53409ea
...
...
@@ -46,8 +46,8 @@ def load_images_from_pdf(pdf_bytes: bytes, dpi=200, start_page_id=0, end_page_id
mat
=
fitz
.
Matrix
(
dpi
/
72
,
dpi
/
72
)
pm
=
page
.
get_pixmap
(
matrix
=
mat
,
alpha
=
False
)
# If the width or height exceeds
90
00 after scaling, do not scale further.
if
pm
.
width
>
90
00
or
pm
.
height
>
90
00
:
# If the width or height exceeds
45
00 after scaling, do not scale further.
if
pm
.
width
>
45
00
or
pm
.
height
>
45
00
:
pm
=
page
.
get_pixmap
(
matrix
=
fitz
.
Matrix
(
1
,
1
),
alpha
=
False
)
img
=
Image
.
frombytes
(
"RGB"
,
(
pm
.
width
,
pm
.
height
),
pm
.
samples
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment