Basically I'm trying to be able to rotate images via user interface, however I've noticed that the image quality severely decreases upon each rotation. Does anyone know how to fix that? Also when the image is rotated it crops off parts of the image each time.
here are some pictures of before and after: http://imgur.com/a/QESKs
And here's the code:
def onRotate(self):
tanTheta = float(hh)/float(ww)
theta = math.atan(tanTheta) * 57.2957795 # convert to degrees
if theta > 0:
angle = (90 - theta) * -1
clockwise = True
elif theta < 0:
angle = (270 - theta) * -1
clockwise = False
else:
tkMessageBox('Angle not okay', 'Try again!')
rotated_small = photo_small.rotate(angle)
rotated_small.save('small_rotate.jpg')
self.load_imgfile('small_rotate.jpg')