Spaces:
Running
Running
Tu Nombre commited on
Commit ·
50ad5e4
1
Parent(s): df20ad5
blur fit entero corregido
Browse files- cliente_template.py +11 -10
cliente_template.py
CHANGED
|
@@ -130,16 +130,17 @@ async def pipeline():
|
|
| 130 |
from PIL import Image as PILImage
|
| 131 |
img = PILImage.open(fp).convert("RGB")
|
| 132 |
w, h = img.size
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
|
|
|
| 143 |
img.save(fp + "_r.jpg", "JPEG", quality=90)
|
| 144 |
cc = IC(fp + "_r.jpg").set_duration(dur_clip)
|
| 145 |
else:
|
|
|
|
| 130 |
from PIL import Image as PILImage
|
| 131 |
img = PILImage.open(fp).convert("RGB")
|
| 132 |
w, h = img.size
|
| 133 |
+
bg = img.resize((1080, 1920), PILImage.LANCZOS)
|
| 134 |
+
from PIL import ImageFilter as _PIF
|
| 135 |
+
bg = bg.filter(_PIF.GaussianBlur(40))
|
| 136 |
+
ratio = min(1080/w, 1920/h)
|
| 137 |
+
new_w = int(w * ratio)
|
| 138 |
+
new_h = int(h * ratio)
|
| 139 |
+
fg = img.resize((new_w, new_h), PILImage.LANCZOS)
|
| 140 |
+
offset_x = (1080 - new_w) // 2
|
| 141 |
+
offset_y = (1920 - new_h) // 2
|
| 142 |
+
bg.paste(fg, (offset_x, offset_y))
|
| 143 |
+
img = bg
|
| 144 |
img.save(fp + "_r.jpg", "JPEG", quality=90)
|
| 145 |
cc = IC(fp + "_r.jpg").set_duration(dur_clip)
|
| 146 |
else:
|