Added autorotation of images

This commit is contained in:
Kovid Goyal 2007-05-18 18:34:47 +00:00
parent 2e6f495305
commit 3736be58bc

View File

@ -740,6 +740,9 @@ class HTMLConverter(object):
im = PILImage.open(path) im = PILImage.open(path)
if width == None or height == None: if width == None or height == None:
width, height = im.size width, height = im.size
if width > height:
im = im.rotate(-90)
width, height = im.size
if height > self.profile.page_height: if height > self.profile.page_height:
corrf = self.profile.page_height/(1.*height) corrf = self.profile.page_height/(1.*height)
width, height = floor(corrf*width), self.profile.page_height-1 width, height = floor(corrf*width), self.profile.page_height-1