Advertisement
denees_k

Untitled

Jan 9th, 2024
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. def resize_(image) -> tuple[int, int]:
  2. w = image.width
  3. h = image.height
  4.  
  5. if w < 1025 and h < 1025:
  6. return w, h
  7.  
  8. if w > h:
  9. c = h / w
  10. h = int(1024 * c)
  11. h = h - (h % 8)
  12. w = 1024
  13. return w, h
  14.  
  15. c = w / h
  16. w = int(1024 * c)
  17. w = w - (w % 8)
  18. h = 1024
  19. return w, h
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement