degal/thumbnail.py
changeset 116 2d3721b9ffd0
parent 115 d5aa320697df
child 122 292aaba6d6ec
equal deleted inserted replaced
115:d5aa320697df 116:2d3721b9ffd0
    56         # calc new size, preserving aspect ratio
    56         # calc new size, preserving aspect ratio
    57         if img_width > thumb_width : 
    57         if img_width > thumb_width : 
    58             height = max(img_height * thumb_width / img_width, 1)
    58             height = max(img_height * thumb_width / img_width, 1)
    59             width = thumb_width
    59             width = thumb_width
    60         
    60         
    61         if img_height > thumb_height :
    61         elif img_height > thumb_height :
    62             width = max(img_width * thumb_height / img_height, 1)
    62             width = max(img_width * thumb_height / img_height, 1)
    63             height = thumb_height
    63             height = thumb_height
    64         
    64         
    65         return width, height 
    65         return width, height 
    66 
    66