Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -18,6 +18,9 @@ def pdf_to_img(pdf_path):
|
|
18 |
base_img = pdf_document.extract_image(image[0])
|
19 |
image_data = base_img["image"]
|
20 |
img = Image.open(io.BytesIO(image_data))
|
|
|
|
|
|
|
21 |
extention = base_img['ext']
|
22 |
img.save(open(f"image{counter}.{extention}","wb"))
|
23 |
img_list.append(f"image{counter}.{extention}")
|
|
|
18 |
base_img = pdf_document.extract_image(image[0])
|
19 |
image_data = base_img["image"]
|
20 |
img = Image.open(io.BytesIO(image_data))
|
21 |
+
if img.mode == "RGBA":
|
22 |
+
# Convert RGBA image to RGB
|
23 |
+
img = img.convert("RGB")
|
24 |
extention = base_img['ext']
|
25 |
img.save(open(f"image{counter}.{extention}","wb"))
|
26 |
img_list.append(f"image{counter}.{extention}")
|