當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。