Show
Ignore:
Timestamp:
08/23/07 15:23:15 (12 months ago)
Author:
mercurial@…
Message:

merge

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • cachers/thumbnail.py

    r139 r165  
    2727def _new_size(image, width, height, scale): 
    2828    """calculate new size""" 
     29    if width == -1: 
     30        width = None 
     31    if height == -1: 
     32        height = None   
    2933    img_width, img_height = image.size 
    3034    if width is None and height is None and scale is None: 
    3135        return image.size 
     36 
     37    if width is not None and height is not None: 
     38        return width, height 
    3239 
    3340    if width is not None or height is not None: 
     
    4956    width, height = _new_size(image, width, height, scale) 
    5057 
    51     image.thumbnail((width, height), Image.ANTIALIAS) 
     58    #image.thumbnail((width, height), Image.ANTIALIAS) 
     59    #image.resize((width, height), Image.ANTIALIAS) 
     60    image.load() 
     61    image = image._new(image.im.stretch((width, height), Image.NEAREST)) 
    5262 
    5363    data = StringIO()