Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
周伟奇
/
pdf_to_img
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
58addb24
authored
2021-01-18 11:42:03 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
convert jpx to jpeg
1 parent
2bf360fb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
pdf_to_img.py
pdf_to_img.py
View file @
58addb2
...
...
@@ -96,6 +96,12 @@ class PDFHandler:
def
extract_single_image
(
self
,
pdf
,
xref
,
smask
,
colorspace
,
pno
,
img_index
=
0
):
pix
=
self
.
recover_pix
(
pdf
,
xref
,
smask
,
colorspace
)
ext
,
img_data
=
self
.
get_img_data
(
pix
)
if
ext
==
'jpx'
:
img_save_path
=
self
.
get_img_save_path
(
pno
,
img_index
=
img_index
)
jpx_pix
=
fitz
.
Pixmap
(
img_data
)
jpx_pix
.
writeImage
(
img_save_path
)
jpx_pix
=
None
else
:
img_save_path
=
self
.
get_img_save_path
(
pno
,
img_index
=
img_index
,
ext
=
ext
)
with
open
(
img_save_path
,
"wb"
)
as
f
:
f
.
write
(
img_data
)
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment