Advertisement
sissou123

Untitled

Jan 12th, 2024
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | Source Code | 0 0
  1. import Image
  2. im = Image.open(<your image>)
  3. width, height = im.size # Get dimensions
  4.  
  5. left = (width - new_width)/2
  6. top = (height - new_height)/2
  7. right = (width + new_width)/2
  8. bottom = (height + new_height)/2
  9.  
  10. # Crop the center of the image
  11. im = im.crop((left, top, right, bottom))
  12. for more: https://cuty.io/BjT4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement