Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def resize_(image) -> tuple[int, int]:
- w = image.width
- h = image.height
- if w < 1025 and h < 1025:
- return w, h
- if w > h:
- c = h / w
- h = int(1024 * c)
- h = h - (h % 8)
- w = 1024
- return w, h
- c = w / h
- w = int(1024 * c)
- w = w - (w % 8)
- h = 1024
- return w, h
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement