Skip to content

Commit a9e68f4

Browse files
committed
bitmap needs to exist outside the try
1 parent fbd81df commit a9e68f4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

unstructured_inference/inference/layout.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -430,14 +430,14 @@ def convert_pdf_to_image(
430430
continue
431431
if last_page is not None and i > last_page:
432432
break
433+
bitmap = page.render(
434+
scale=scale,
435+
no_smoothtext=False,
436+
no_smoothimage=False,
437+
no_smoothpath=False,
438+
optimize_mode="print",
439+
)
433440
try:
434-
bitmap = page.render(
435-
scale=scale,
436-
no_smoothtext=False,
437-
no_smoothimage=False,
438-
no_smoothpath=False,
439-
optimize_mode="print",
440-
)
441441
images[i] = bitmap.to_pil()
442442
finally:
443443
bitmap.close()

0 commit comments

Comments
 (0)