change size
Browse files- image_ops.py +4 -1
image_ops.py
CHANGED
|
@@ -6,10 +6,13 @@ def resize_pil_image(
|
|
| 6 |
image_width,
|
| 7 |
image_height,
|
| 8 |
):
|
|
|
|
|
|
|
|
|
|
| 9 |
return pil_image.convert("RGB").resize(
|
| 10 |
(
|
| 11 |
image_width,
|
| 12 |
-
|
| 13 |
),
|
| 14 |
Image.Resampling.LANCZOS,
|
| 15 |
)
|
|
|
|
| 6 |
image_width,
|
| 7 |
image_height,
|
| 8 |
):
|
| 9 |
+
w, h = pil_image.size
|
| 10 |
+
newW = image_width
|
| 11 |
+
newH = int(h * newW / w)
|
| 12 |
return pil_image.convert("RGB").resize(
|
| 13 |
(
|
| 14 |
image_width,
|
| 15 |
+
newH,
|
| 16 |
),
|
| 17 |
Image.Resampling.LANCZOS,
|
| 18 |
)
|