

def pil_resize(maxwidth, path_in, path_out=None):
    'Resize using Python Imaging Library (PIL).  Return the output path\n    of resized image.\n    '
    path_out = (path_out or temp_file_for(path_in))
    from PIL import Image
    log.debug('artresizer: PIL resizing {0} to {1}', util.displayable_path(path_in), util.displayable_path(path_out))
    try:
        im = Image.open(util.syspath(path_in))
        size = (maxwidth, maxwidth)
        im.thumbnail(size, Image.ANTIALIAS)
        im.save(path_out)
        return path_out
    except IOError:
        log.error("PIL cannot create thumbnail for '{0}'", util.displayable_path(path_in))
        return path_in

dataset/ETHPy150Open beetbox/beets/beets/util/artresizer.py pil_resize/original