Python PIL.ImageChops.multiply() Examples
The following are 6
code examples of PIL.ImageChops.multiply().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PIL.ImageChops
, or try the search function
.
Example #1
Source File: combiner_ops.py From material-combiner-addon with MIT License | 6 votes |
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
Example #2
Source File: test_imagechops.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
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)
Example #3
Source File: test_imagechops.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
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)
Example #4
Source File: test_imagechops.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
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)
Example #5
Source File: test_imagechops.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
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)
Example #6
Source File: pildriver.py From mxnet-lambda with Apache License 2.0 | 5 votes |
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))