Spaces:
Sleeping
Sleeping
Commit
·
e341445
1
Parent(s):
5c05390
Update app.py
Browse files
app.py
CHANGED
@@ -32,7 +32,10 @@ def cbr_to_pdf(cbr_bytes):
|
|
32 |
for img_file in sorted(os.listdir(temp_dir)):
|
33 |
if img_file.endswith((".png", ".jpg", ".jpeg")):
|
34 |
img_path = os.path.join(temp_dir, img_file)
|
35 |
-
|
|
|
|
|
|
|
36 |
|
37 |
pdf.save(pdf_filename)
|
38 |
pdf.close()
|
|
|
32 |
for img_file in sorted(os.listdir(temp_dir)):
|
33 |
if img_file.endswith((".png", ".jpg", ".jpeg")):
|
34 |
img_path = os.path.join(temp_dir, img_file)
|
35 |
+
img = fitz.open(img_path)
|
36 |
+
rect = img[0].rect # Dimensiones de la imagen
|
37 |
+
pdf_page = pdf.new_page(width=rect.width, height=rect.height) # Crear página vacía con dimensiones de la imagen
|
38 |
+
pdf_page.insert_image(rect, filename=img_path) # Insertar imagen en la página
|
39 |
|
40 |
pdf.save(pdf_filename)
|
41 |
pdf.close()
|