diff --git a/compression.py b/compression.py index 0bab0d9..b25f146 100644 --- a/compression.py +++ b/compression.py @@ -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) diff --git a/function_app.py b/function_app.py index 8fe707f..573a7ea 100644 --- a/function_app.py +++ b/function_app.py @@ -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", @@ -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")