Last active
April 20, 2021 11:41
-
-
Save ilyasProgrammer/3708c6260ec3fde837b1be60f678c132 to your computer and use it in GitHub Desktop.
PDF to Image and rotate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pdf2image import convert_from_path, convert_from_bytes | |
from io import BytesIO | |
image = convert_from_bytes(base64.decodebytes(att.datas))[0].rotate(90, expand=True) | |
buffered = BytesIO() | |
image.save(buffered, format="JPEG") | |
img_str = base64.b64encode(buffered.getvalue()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment