Update myapp.py
Browse files
myapp.py
CHANGED
|
@@ -17,13 +17,13 @@ def upscale_image():
|
|
| 17 |
return jsonify({"error": "No image provided"}), 400
|
| 18 |
|
| 19 |
input_image = request.files['image'].read() # Read the uploaded image
|
| 20 |
-
width = int(request.form.get('width', 2)) #
|
| 21 |
height = int(request.form.get('height', 2))
|
| 22 |
|
| 23 |
# Open the image using PIL
|
| 24 |
img = Image.open(io.BytesIO(input_image))
|
| 25 |
|
| 26 |
-
# Resize the image
|
| 27 |
upscaled_img = img.resize((img.width * width, img.height * height), Image.LANCZOS)
|
| 28 |
|
| 29 |
# Save to bytes
|
|
|
|
| 17 |
return jsonify({"error": "No image provided"}), 400
|
| 18 |
|
| 19 |
input_image = request.files['image'].read() # Read the uploaded image
|
| 20 |
+
width = int(request.form.get('width', 2)) # User-specified upscale factor
|
| 21 |
height = int(request.form.get('height', 2))
|
| 22 |
|
| 23 |
# Open the image using PIL
|
| 24 |
img = Image.open(io.BytesIO(input_image))
|
| 25 |
|
| 26 |
+
# Resize the image using user-defined width and height
|
| 27 |
upscaled_img = img.resize((img.width * width, img.height * height), Image.LANCZOS)
|
| 28 |
|
| 29 |
# Save to bytes
|