Advertisement
Guest User

flipped puppy

a guest
Apr 5th, 2020
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. from PIL import Image
  2.  
  3. original = Image.open("puppy.bmp")
  4.  
  5. ori_width, ori_height = original.size
  6.  
  7. flipped = Image.new("RGB", (ori_width, ori_height))
  8.  
  9. for y in range(ori_height):
  10.     for x in range(ori_width):
  11.         pixel = original.getpixel((x, y))
  12.         flipped.putpixel((x, ori_height - 1 - y), pixel)
  13.  
  14. flipped.save('fliped_puppy.jpg', 'JPEG')
  15. flipped.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement