You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
762 B
36 lines
762 B
from PIL import Image
|
|
import time
|
|
|
|
i = 1
|
|
|
|
while True:
|
|
|
|
page = Image.open("split/input%i.jpg"%i)
|
|
|
|
if i % 2 == 0:
|
|
#check where the for loop is
|
|
print("trying even")
|
|
|
|
#rotate image by 90 degrees
|
|
angle = 90
|
|
out = page.rotate(angle, expand=True)
|
|
out.save('rotated/input%i.jpg'%i)
|
|
print('This is an even page number')
|
|
|
|
time.sleep(2)
|
|
print("variable i: ", i)
|
|
|
|
else:
|
|
#check where the for loop is
|
|
print("trying odd")
|
|
|
|
#rotate image by 90 degrees
|
|
angle = 270
|
|
out = page.rotate(angle, expand=True)
|
|
out.save('rotated/input%i.jpg'%i)
|
|
print('This is an odd page number')
|
|
|
|
time.sleep(1)
|
|
print("variable i: ", i)
|
|
|
|
i+=1
|
|
|