Skip to content

Instantly share code, notes, and snippets.

@vvdr12
Created September 18, 2013 21:40
Show Gist options
  • Save vvdr12/6616148 to your computer and use it in GitHub Desktop.
Save vvdr12/6616148 to your computer and use it in GitHub Desktop.
Put test.jpg in same folder as script. Written for python 2.x. Written for linux so you may need to remove first line of code. Must have PIL library installed.
#! /usr/bin/python
import Image
#Created by vvdr12
#No rights reserved :)
#Have fun and do what you will with it.
#_______________________________________________________source
source = Image.open("test.jpg")
img = source.load()
print source.format
print source.size
print source.mode
x = source.size[0]
y = source.size[1]
#_______________________________________________________run
rotation=int(raw_input("\nRotation steps in degrees: (10 is always a safe bet)\n>>>"))
num_rotation=int(raw_input("\nNumber of full rotations: (10 is nice, but may take long)\n>>>"))
end=(360/rotation)*num_rotation
print end
j=0
l1=1
while l1==1:
if j%10==0:
print j, "/", end
source=source.rotate(rotation)
img = source.load()
j=j+1
if j==end:#test .. is usually if j==y:
l1=0
#_______________________________________________________save
source.save("rotation_losses.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment