palette.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:clitorisvulgaris 作者: fhoehl 项目源码 文件源码
def prepare_image(image_fd):
    """Returns a PIL image from the given file descriptor. The image is
    resized in order to filtrate dominant colors and ease k-means computation.
    The contrast of the image is also enhanced to help find more saturated
    colors.
    """

    image = Image.open(image_fd)
    image.thumbnail(THUMBNAIL_SIZE)
    contrast = ImageEnhance.Contrast(image)
    image_high_contrast = contrast.enhance(CONTRAST)

    return image_high_contrast
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号