Better picture scaling

svn: r168
This commit is contained in:
Don Allingham 2001-06-20 02:25:18 +00:00
parent 9d17da7ee2
commit 12d9b85db5

View File

@ -237,16 +237,16 @@ class HtmlDoc(TextDoc):
scale = float(nx)/float(ny) scale = float(nx)/float(ny)
if scale > 1.0: if scale > 1.0:
scale = 1.0/scale scale = 1.0/scale
act_width = x act_width = float(x)
act_height = y * scale act_height = float(y * scale)
else: else:
act_width = x * scale act_width = float(x * scale)
act_height = y act_height = float(y)
cmtopt = 72.0/2.54 cmtopt = float(150.0/2.54)
pixw = int(act_width*cmtopt) pixx = int(act_width*cmtopt)
pixx = int(act_height*cmtopt) pixy = int(act_height*cmtopt)
im.thumbnail((pixw,pixx)) im.thumbnail((pixx,pixy))
imdir = self.base + os.sep + "images" imdir = self.base + os.sep + "images"
if not os.path.isdir(imdir): if not os.path.isdir(imdir):
@ -262,7 +262,7 @@ class HtmlDoc(TextDoc):
return return
self.f.write('<img src="images/%s" width="%d" height="%d">\n' % \ self.f.write('<img src="images/%s" width="%d" height="%d">\n' % \
(refname,pixw,pixx)) (refname,pixx,pixy))
def start_table(self,name,style): def start_table(self,name,style):
self.tbl = self.table_styles[style] self.tbl = self.table_styles[style]