mirror of
https://github.com/ocrmypdf/OCRmyPDF.git
synced 2025-12-28 15:39:08 +00:00
Optimize: use img2pdf stream instead of repeated copies
This commit is contained in:
parent
354e61946e
commit
a0952bfca3
@ -591,9 +591,8 @@ def select_image_layer(
|
||||
else:
|
||||
pageinfo = get_pageinfo(image, pdfinfo, pdfinfo_lock)
|
||||
dpi = round(max(pageinfo['xres'], pageinfo['yres'], options.oversample))
|
||||
pdf_bytes = img2pdf.convert([image], dpi=dpi)
|
||||
with open(output_file, 'wb') as pdf:
|
||||
pdf.write(pdf_bytes)
|
||||
img2pdf.convert([image], dpi=dpi, outputstream=pdf)
|
||||
|
||||
|
||||
@active_if(options.pdf_renderer == 'hocr')
|
||||
|
||||
@ -2,4 +2,4 @@ ruffus>=2.6.3
|
||||
Pillow>=2.4.0
|
||||
reportlab>=3.1.44
|
||||
PyPDF2>=1.25.1
|
||||
img2pdf>=0.1.5
|
||||
git+https://github.com/jbarlow83/img2pdf.git@1261741136dcbfed65355ed93f4930617a55feee#egg=img2pdf
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user