convert jpx to jpeg
Showing
1 changed file
with
9 additions
and
3 deletions
... | @@ -96,9 +96,15 @@ class PDFHandler: | ... | @@ -96,9 +96,15 @@ class PDFHandler: |
96 | def extract_single_image(self, pdf, xref, smask, colorspace, pno, img_index=0): | 96 | def extract_single_image(self, pdf, xref, smask, colorspace, pno, img_index=0): |
97 | pix = self.recover_pix(pdf, xref, smask, colorspace) | 97 | pix = self.recover_pix(pdf, xref, smask, colorspace) |
98 | ext, img_data = self.get_img_data(pix) | 98 | ext, img_data = self.get_img_data(pix) |
99 | img_save_path = self.get_img_save_path(pno, img_index=img_index, ext=ext) | 99 | if ext == 'jpx': |
100 | with open(img_save_path, "wb") as f: | 100 | img_save_path = self.get_img_save_path(pno, img_index=img_index) |
101 | f.write(img_data) | 101 | jpx_pix = fitz.Pixmap(img_data) |
102 | jpx_pix.writeImage(img_save_path) | ||
103 | jpx_pix = None | ||
104 | else: | ||
105 | img_save_path = self.get_img_save_path(pno, img_index=img_index, ext=ext) | ||
106 | with open(img_save_path, "wb") as f: | ||
107 | f.write(img_data) | ||
102 | self.xref_set.add(xref) | 108 | self.xref_set.add(xref) |
103 | 109 | ||
104 | @staticmethod | 110 | @staticmethod | ... | ... |
-
Please register or sign in to post a comment