def make_thumb(image_path, width):
    """Make a thumbnail and save it in the same directory as the original.

       See get_thumb_path() for the arguments.
       @return The thumbnail filename, or None if PIL
           didn't recognize the image type.

       Does NOT work with PDF originals; use make_thumb_from_pdf for those.
    """
    dst = get_thumb_path(image_path, width)
    im = open_image(image_path)
    if im is None:
        return None
    orig_width, orig_height = im.size
    height = choose_height(width, orig_width, orig_height)
    if im.mode == 'P':
        im = im.convert()   # Convert GIF palette to RGB mode.
    try:
        im.thumbnail((width, height), Image.ANTIALIAS)
    except __HOLE__, e:
        reason = str(e)
        if RX_DECODER_NOT_AVAILABLE.search(reason):
            return None   # PIL error, cannot thumbnail.
        else:
            raise
    im.save(dst, THUMB_PIL_TYPE)
    return dst
dataset/ETHPy150Open mikeorr/WebHelpers2/unfinished/multimedia.py/make_thumb