Image.py 文件源码

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

项目:CNCGToolKit 作者: cineuse 项目源码 文件源码
def point(self, lut, mode=None):
        "Map image through lookup table"

        self.load()

        if isinstance(lut, ImagePointHandler):
            return lut.point(self)

        if not isSequenceType(lut):
            # if it isn't a list, it should be a function
            if self.mode in ("I", "I;16", "F"):
                # check if the function can be used with point_transform
                scale, offset = _getscaleoffset(lut)
                return self._new(self.im.point_transform(scale, offset))
            # for other modes, convert the function to a table
            lut = map(lut, range(256)) * self.im.bands

        if self.mode == "F":
            # FIXME: _imaging returns a confusing error message for this case
            raise ValueError("point operation not supported for this mode")

        return self._new(self.im.point(lut, mode))

    ##
    # Adds or replaces the alpha layer in this image.  If the image
    # does not have an alpha layer, it's converted to "LA" or "RGBA".
    # The new layer must be either "L" or "1".
    #
    # @param im The new alpha layer.  This can either be an "L" or "1"
    #    image having the same size as this image, or an integer or
    #    other color value.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号