Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
66f66f4
1
Parent(s):
ba346b2
Update utils.py
Browse files
utils.py
CHANGED
|
@@ -43,8 +43,8 @@ def video_to_frames(video_path, img_size=(512,512)):
|
|
| 43 |
|
| 44 |
# get new height and width to maintain aspect ratio
|
| 45 |
height, width = image.size
|
| 46 |
-
new_height = img_size[0] * height / width
|
| 47 |
-
new_width = img_size[1] * width / height
|
| 48 |
|
| 49 |
# pad
|
| 50 |
image = Image.new(image.mode, (new_width, new_height), (0, 0, 0))
|
|
|
|
| 43 |
|
| 44 |
# get new height and width to maintain aspect ratio
|
| 45 |
height, width = image.size
|
| 46 |
+
new_height = math.floor(img_size[0] * height / width)
|
| 47 |
+
new_width = math.floor(img_size[1] * width / height)
|
| 48 |
|
| 49 |
# pad
|
| 50 |
image = Image.new(image.mode, (new_width, new_height), (0, 0, 0))
|