Created
September 18, 2013 21:40
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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