enter image description hereThats the code, the problem is after saving the pdf it appears black. But some tiffs while conversion are saved and converted properly, But some go black.
import json
import urllib.parse
import boto3
import os
import img2pdf
from PIL import Image
path = r"SI-1.tif"
im = Image.open(path)
(file1, ext) = os.path.splitext(path)
print(file1)
print(ext)
pdf_Path = "static\A.pdf"
if ext.lower() == '.tif' or ext.lower() == '.jpg':
pdf_bytes = img2pdf.convert(im.filename)
# opening or creating pdf file
file = open(pdf_Path, "wb")
# writing pdf files with chunks
file.write(pdf_bytes)