Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PIL import Image
- original = Image.open("puppy.bmp")
- ori_width, ori_height = original.size
- rot_width, rot_height = ori_width, ori_height
- rotated = Image.new("RGB" , (rot_width,rot_height))
- for y in range(ori_height):
- for x in range(ori_width):
- pixel = original.getpixel((x,y))
- rotated.putpixel((rot_width - x - 1, rot_height - y - 1), pixel)
- rotated.save('rotated_puppy_2.jpg','JPEG')
- rotated.show() #only on Mu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement