Skip to content

Commit

Permalink
increase image quality
Browse files Browse the repository at this point in the history
  • Loading branch information
ihaveamicroservice committed Oct 7, 2023
1 parent 72e7723 commit 5b3b1f1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def compress(inputblob: func.InputStream, resolution: int) -> bytes:

# Save thumbnail to a BytesIO object
output_stream = io.BytesIO()
image.save(output_stream, format=image.format)
image.save(output_stream, format=image.format, quality=85)

# Move back to the beginning of the stream
output_stream.seek(0)
Expand Down
4 changes: 2 additions & 2 deletions function_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
connection=CONNECTION)
def compress_image_for_detail_view(inputblob: func.InputStream, outputblob: func.Out[str]):
logging.info(f"Compressing '{inputblob.name}' for detail view")
compressed_image = compression.compress(inputblob, 500)
compressed_image = compression.compress(inputblob, 1200)
outputblob.set(compressed_image)

@app.blob_trigger(arg_name="inputblob",
Expand All @@ -30,7 +30,7 @@ def compress_image_for_detail_view(inputblob: func.InputStream, outputblob: func
connection=CONNECTION)
def compress_image_for_thumbnail(inputblob: func.InputStream, outputblob: func.Out[str]):
logging.info(f"Compressing '{inputblob.name}' for thumbnail")
compressed_image = compression.compress(inputblob, 200)
compressed_image = compression.compress(inputblob, 400)
outputblob.set(compressed_image)

@app.event_grid_trigger(arg_name="azeventgrid")
Expand Down

0 comments on commit 5b3b1f1

Please sign in to comment.