mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-14 19:36:38 +03:00
Merge pull request #2627 from radarhere/alpha_composite
Corrected alpha_composite args documentation
This commit is contained in:
commit
730cf93c32
20
PIL/Image.py
20
PIL/Image.py
|
@ -1069,7 +1069,7 @@ class Image(object):
|
||||||
_decompression_bomb_check((x1, y1))
|
_decompression_bomb_check((x1, y1))
|
||||||
|
|
||||||
return im.crop((x0, y0, x1, y1))
|
return im.crop((x0, y0, x1, y1))
|
||||||
|
|
||||||
def draft(self, mode, size):
|
def draft(self, mode, size):
|
||||||
"""
|
"""
|
||||||
Configures the image file loader so it returns a version of the
|
Configures the image file loader so it returns a version of the
|
||||||
|
@ -1381,12 +1381,12 @@ class Image(object):
|
||||||
onto this image.
|
onto this image.
|
||||||
|
|
||||||
:param im: image to composite over this one
|
:param im: image to composite over this one
|
||||||
:param dest: Optional 2 tuple (top, left) specifying the upper
|
:param dest: Optional 2 tuple (left, top) specifying the upper
|
||||||
left corner in this (destination) image.
|
left corner in this (destination) image.
|
||||||
:param source: Optional 2 (top, left) tuple for the upper left
|
:param source: Optional 2 (left, top) tuple for the upper left
|
||||||
corner in the overlay source image, or 4 tuple (top, left, bottom,
|
corner in the overlay source image, or 4 tuple (left, top, right,
|
||||||
right) for the bounds of the source rectangle
|
bottom) for the bounds of the source rectangle
|
||||||
|
|
||||||
Performance Note: Not currently implemented in-place in the core layer.
|
Performance Note: Not currently implemented in-place in the core layer.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -1406,7 +1406,7 @@ class Image(object):
|
||||||
if len(source) == 2:
|
if len(source) == 2:
|
||||||
source = source + im.size
|
source = source + im.size
|
||||||
|
|
||||||
# over image, crop if it's not the whole thing.
|
# over image, crop if it's not the whole thing.
|
||||||
if source == (0,0) + im.size:
|
if source == (0,0) + im.size:
|
||||||
overlay = im
|
overlay = im
|
||||||
else:
|
else:
|
||||||
|
@ -1414,16 +1414,16 @@ class Image(object):
|
||||||
|
|
||||||
# target for the paste
|
# target for the paste
|
||||||
box = dest + (dest[0] + overlay.width, dest[1] + overlay.height)
|
box = dest + (dest[0] + overlay.width, dest[1] + overlay.height)
|
||||||
|
|
||||||
# destination image. don't copy if we're using the whole image.
|
# destination image. don't copy if we're using the whole image.
|
||||||
if dest == (0,0) + self.size:
|
if dest == (0,0) + self.size:
|
||||||
background = self
|
background = self
|
||||||
else:
|
else:
|
||||||
background = self.crop(box)
|
background = self.crop(box)
|
||||||
|
|
||||||
result = alpha_composite(background, overlay)
|
result = alpha_composite(background, overlay)
|
||||||
self.paste(result, box)
|
self.paste(result, box)
|
||||||
|
|
||||||
def point(self, lut, mode=None):
|
def point(self, lut, mode=None):
|
||||||
"""
|
"""
|
||||||
Maps this image through a lookup table or function.
|
Maps this image through a lookup table or function.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user