本文整理汇总了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
示例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)
示例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)
示例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)
示例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)
示例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))