Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import os, io
import logging
from PIL import Image
import azure.functions as func
import tempfile
from import BlockBlobService
from pdf2image import convert_from_path, convert_from_bytes
BlobAccount = os.environ['BlobAccount']
BlobKey = os.environ['BlobKey']
BlobItem = os.environ['BlobItem']
def main(myblob: func.InputStream):"Python blob trigger function processed blob \n"
f"Name: {}\n"
f"Blob Size: {myblob.length} bytes")
file =
image = io.BytesIO(file)
blob_service = BlockBlobService(account_name=BlobAccount, account_key=BlobKey)
blob_name = + "/", "")
with open(blob_name, "wb") as outfile:
# Copy the BytesIO stream to the output file
with tempfile.TemporaryDirectory() as path:
pages = convert_from_path(blob_name,dpi=600, output_folder=path)
for page in pages:
filename = str(x)+".jpg", "JPEG")
x = x +1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.