当前位置: 首页>>代码示例>>Python>>正文


Python ImageChops.multiply方法代码示例

本文整理汇总了Python中PIL.ImageChops.multiply方法的典型用法代码示例。如果您正苦于以下问题:Python ImageChops.multiply方法的具体用法?Python ImageChops.multiply怎么用?Python ImageChops.multiply使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PIL.ImageChops的用法示例。


在下文中一共展示了ImageChops.multiply方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_gfx

# 需要导入模块: from PIL import ImageChops [as 别名]
# 或者: from PIL.ImageChops import multiply [as 别名]
def get_gfx(scn, mat, item, src):
    size = tuple(size - int(scn.smc_gaps) for size in item['gfx']['size'])
    if isinstance(src, str):
        if src:
            img = Image.open(src).convert('RGBA')
            if img.size != size:
                img.resize(size, Image.ANTIALIAS)
            if mat.smc_size:
                img.thumbnail((mat.smc_size_width, mat.smc_size_height), Image.ANTIALIAS)
            if any(item['gfx']['uv_size']) > 0.999:
                img = get_uv_image(item, img, size)
            if mat.smc_diffuse:
                diffuse_img = Image.new('RGBA', size, get_diffuse(mat))
                img = ImageChops.multiply(img, diffuse_img)
        else:
            img = Image.new('RGBA', size, get_diffuse(mat))
    else:
        img = Image.new('RGBA', size, src)
    return img 
开发者ID:Grim-es,项目名称:material-combiner-addon,代码行数:21,代码来源:combiner_ops.py

示例2: test_sanity

# 需要导入模块: from PIL import ImageChops [as 别名]
# 或者: from PIL.ImageChops import multiply [as 别名]
def test_sanity(self):

        im = hopper("L")

        ImageChops.constant(im, 128)
        ImageChops.duplicate(im)
        ImageChops.invert(im)
        ImageChops.lighter(im, im)
        ImageChops.darker(im, im)
        ImageChops.difference(im, im)
        ImageChops.multiply(im, im)
        ImageChops.screen(im, im)

        ImageChops.add(im, im)
        ImageChops.add(im, im, 2.0)
        ImageChops.add(im, im, 2.0, 128)
        ImageChops.subtract(im, im)
        ImageChops.subtract(im, im, 2.0)
        ImageChops.subtract(im, im, 2.0, 128)

        ImageChops.add_modulo(im, im)
        ImageChops.subtract_modulo(im, im)

        ImageChops.blend(im, im, 0.5)
        ImageChops.composite(im, im, im)

        ImageChops.offset(im, 10)
        ImageChops.offset(im, 10, 20) 
开发者ID:holzschu,项目名称:python3_ios,代码行数:30,代码来源:test_imagechops.py

示例3: test_multiply_black

# 需要导入模块: from PIL import ImageChops [as 别名]
# 或者: from PIL.ImageChops import multiply [as 别名]
def test_multiply_black(self):
        """If you multiply an image with a solid black image,
        the result is black."""
        # Arrange
        im1 = hopper()
        black = Image.new("RGB", im1.size, "black")

        # Act
        new = ImageChops.multiply(im1, black)

        # Assert
        self.assert_image_equal(new, black) 
开发者ID:holzschu,项目名称:python3_ios,代码行数:14,代码来源:test_imagechops.py

示例4: test_multiply_green

# 需要导入模块: from PIL import ImageChops [as 别名]
# 或者: from PIL.ImageChops import multiply [as 别名]
def test_multiply_green(self):
        # Arrange
        im = Image.open("Tests/images/imagedraw_floodfill_RGB.png")
        green = Image.new("RGB", im.size, "green")

        # Act
        new = ImageChops.multiply(im, green)

        # Assert
        self.assertEqual(new.getbbox(), (25, 25, 76, 76))
        self.assertEqual(new.getpixel((25, 25)), DARK_GREEN)
        self.assertEqual(new.getpixel((50, 50)), BLACK) 
开发者ID:holzschu,项目名称:python3_ios,代码行数:14,代码来源:test_imagechops.py

示例5: test_multiply_white

# 需要导入模块: from PIL import ImageChops [as 别名]
# 或者: from PIL.ImageChops import multiply [as 别名]
def test_multiply_white(self):
        """If you multiply with a solid white image,
        the image is unaffected."""
        # Arrange
        im1 = hopper()
        white = Image.new("RGB", im1.size, "white")

        # Act
        new = ImageChops.multiply(im1, white)

        # Assert
        self.assert_image_equal(new, im1) 
开发者ID:holzschu,项目名称:python3_ios,代码行数:14,代码来源:test_imagechops.py

示例6: do_multiply

# 需要导入模块: from PIL import ImageChops [as 别名]
# 或者: from PIL.ImageChops import multiply [as 别名]
def do_multiply(self):
        """usage: multiply <image:pic1> <image:pic2>

        Pop the two top images, push the multiplication image.
        """
        from PIL import ImageChops
        image1 = self.do_pop()
        image2 = self.do_pop()
        self.push(ImageChops.multiply(image1, image2)) 
开发者ID:awslabs,项目名称:mxnet-lambda,代码行数:11,代码来源:pildriver.py


注:本文中的PIL.ImageChops.multiply方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。