Advertisement
here2share

# b_resize_function.py

Aug 9th, 2022
898
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. # b_resize_function.py
  2.  
  3. # to resize (w,h) to fit the target area size
  4. def resize(w, h, target_area):
  5.     ratio = (target_area / (w * h))**0.5
  6.     return int(w * ratio), int(h * ratio)
  7.  
  8. ww = 900
  9. hh = 1600
  10. j = int((ww/2)*(hh/2))
  11. while 1:
  12.     i = resize(ww,hh,j)
  13.     if i[0] > ww*2:
  14.         break
  15.     else:
  16.         print(i,j)
  17.         j += 200000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement