本文整理匯總了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))