Blendmodes Index / Blendmodes / Blend
Auto-generated documentation for blendmodes.blend module.
- Blend
- _lum
- _sat
- _setLum
- _setSat
- additive
- alpha_comp_shell
- blend
- blendLayers
- blendLayersArray
- colour
- colourburn
- colourdodge
- darken
- destatop
- destin
- destout
- difference
- divide
- exclusion
- glow
- grainextract
- grainmerge
- hardlight
- hue
- imageFloatToInt
- imageIntToFloat
- lighten
- luminosity
- multiply
- negation
- normal
- overlay
- pinlight
- reflect
- saturation
- screen
- softlight
- srcatop
- vividlight
- xor
Luminosity.
colours
- x by x by 3 matrix of rgb color components of pixels
x by x by 3 matrix of luminosity of pixels
def _lum(colours: np.ndarray) -> np.ndarray: ...
Saturation.
colours
- x by x by 3 matrix of rgb color components of pixels
int of saturation of pixels
def _sat(colours: np.ndarray) -> np.ndarray: ...
Set a new luminosity value for the matrix of color.
def _setLum(originalColours: np.ndarray, newLuminosity: np.ndarray) -> np.ndarray: ...
Set a new saturation value for the matrix of color.
def _setSat(originalColours: np.ndarray, newSaturation: np.ndarray) -> np.ndarray: ...
BlendType.ADDITIVE.
def additive(background: np.ndarray, foreground: np.ndarray) -> np.ndarray: ...
Implement common transformations occurring in any blend or composite mode.
def alpha_comp_shell(
lower_alpha: np.ndarray,
upper_alpha: np.ndarray,
lower_rgb: np.ndarray,
upper_rgb: np.ndarray,
blendType: BlendType,
) -> tuple[np.ndarray, np.ndarray]: ...
Blend pixels.
background
np.ndarray - backgroundforeground
np.ndarray - foregroundblendType
BlendType - the blend type
-
np.ndarray
- new array representing the image -
background
- np.ndarray, -
foreground
- np.ndarray and the return are in the form
[[[0. 0. 0.] [0. 0. 0.] [0. 0. 0.] ... [0. 0. 0.] [0. 0. 0.] [0. 0. 0.]]
...
[[0. 0. 0.] [0. 0. 0.] [0. 0. 0.] ... [0. 0. 0.] [0. 0. 0.] [0. 0. 0.]]]
def blend(
background: np.ndarray, foreground: np.ndarray, blendType: BlendType
) -> np.ndarray: ...
Blend two layers (background and foreground), where the background may be cropped if smaller than the foreground.
:param Image.Image background: The background layer. :param Image.Image foreground: The foreground layer (must be the same size as the background).
blendType
BlendType - The blend type to be applied.opacity
float - The opacity of the foreground image. Defaults to 1.0. (optional) :param tuple[int, int] offsets: Offsets for the foreground layer. Defaults to (0, 0). (optional)
Type: Image.Image The combined image.
Blend two layers with default parameters
>>> combined_image = blendLayers(background_image, foreground_image, BlendType.NORMAL)
Blend two layers with custom opacity and offsets
>>> combined_image = blendLayers(
... background_image,
... foreground_image,
... BlendType.MULTIPLY,
... opacity=0.7,
... offsets=(100, 50)
...)
def blendLayers(
background: Image.Image,
foreground: Image.Image,
blendType: BlendType,
opacity: float = 1.0,
offsets: tuple[int, int] = (0, 0),
) -> Image.Image: ...
Blend two layers (background and foreground), where the background may be cropped if smaller than the foreground.
:param np.ndarray | Image.Image background: The background layer. :param np.ndarray | Image.Image foreground: The foreground layer (must be the same size as the background).
blendType
BlendType - The blend type to be applied.opacity
float - The opacity of the foreground image. Defaults to 1.0. (optional) :param tuple[int, int] offsets: Offsets for the foreground layer. Defaults to (0, 0). (optional)
Type: np.ndarray The combined image.
Blend two layers with default parameters
>>> combined_image = blendLayers(background_image, foreground_image, BlendType.NORMAL)
Blend two layers with custom opacity and offsets
>>> combined_image = blendLayers(
... background_image,
... foreground_image,
... BlendType.MULTIPLY,
... opacity=0.7,
... offsets=(100, 50)
...)
def blendLayersArray(
background: np.ndarray | Image.Image,
foreground: np.ndarray | Image.Image,
blendType: BlendType,
opacity: float = 1.0,
offsets: tuple[int, int] = (0, 0),
) -> np.ndarray: ...
BlendType.COLOUR.
def colour(background: np.ndarray, foreground: np.ndarray) -> np.ndarray: ...
BlendType.COLOURBURN.
def colourburn(background: np.ndarray, foreground: np.ndarray) -> np.ndarray: ...
BlendType.COLOURDODGE.
def colourdodge(background: np.ndarray, foreground: np.ndarray) -> np.ndarray: ...
BlendType.DARKEN.
def darken(background: np.ndarray, foreground: np.ndarray) -> np.ndarray: ...
Place the layer below above the 'layer above' in places where the 'layer above' exists...
where 'layer below' does not exist, but 'layer above' does, place 'layer-above'
def destatop(
backgroundAlpha: np.ndarray,
foregroundAlpha: np.ndarray,
backgroundColour: np.ndarray,
foregroundColour: np.ndarray,
) -> tuple[np.ndarray, np.ndarray]: ...
'clip' composite mode.
All parts of 'layer above' which are alpha in 'layer below' will be made also alpha in 'layer above' (to whatever degree of alpha they were)
Destination which overlaps the source, replaces the source.
Fa = 0; Fb = as co = ab x Cb x as ao = ab x as
def destin(
backgroundAlpha: np.ndarray,
foregroundAlpha: np.ndarray,
backgroundColour: np.ndarray,
foregroundColour: np.ndarray,
) -> tuple[np.ndarray, np.ndarray]: ...
Reverse 'Clip' composite mode.
All parts of 'layer below' which are alpha in 'layer above' will be made also alpha in 'layer below' (to whatever degree of alpha they were)
def destout(
backgroundAlpha: np.ndarray,
foregroundAlpha: np.ndarray,
backgroundColour: np.ndarray,
foregroundColour: np.ndarray,
) -> tuple[np.ndarray, np.ndarray]: ...
BlendType.DIFFERENCE.
def difference(background: np.ndarray, foreground: np.ndarray) -> np.ndarray: ...
BlendType.DIVIDE.
def divide(background: np.ndarray, foreground: np.ndarray) -> np.ndarray: ...
BlendType.EXCLUSION.
def exclusion(background: np.ndarray, foreground: np.ndarray) -> np.ndarray: ...
BlendType.GLOW.
def glow(background: np.ndarray, foreground: np.ndarray) -> np.ndarray: ...
BlendType.GRAINEXTRACT.
def grainextract(background: np.ndarray, foreground: np.ndarray) -> np.ndarray: ...
BlendType.GRAINMERGE.
def grainmerge(background: np.ndarray, foreground: np.ndarray) -> np.ndarray: ...
BlendType.HARDLIGHT.
def hardlight(background: np.ndarray, foreground: np.ndarray) -> np.ndarray: ...
BlendType.HUE.
def hue(background: np.ndarray, foreground: np.ndarray) -> np.ndarray: ...
Convert a numpy array representing an image to an array of ints.
image
np.ndarray - numpy array of floats
np.ndarray
- numpy array of ints
def imageFloatToInt(image: np.ndarray) -> np.ndarray: ...
Convert a numpy array representing an image to an array of floats.
image
np.ndarray - numpy array of ints
np.ndarray
- numpy array of floats
def imageIntToFloat(image: np.ndarray) -> np.ndarray: ...
BlendType.LIGHTEN.
def lighten(background: np.ndarray, foreground: np.ndarray) -> np.ndarray: ...
BlendType.LUMINOSITY.
def luminosity(background: np.ndarray, foreground: np.ndarray) -> np.ndarray: ...
BlendType.MULTIPLY.
def multiply(background: np.ndarray, foreground: np.ndarray) -> np.ndarray: ...
BlendType.NEGATION.
def negation(background: np.ndarray, foreground: np.ndarray) -> np.ndarray: ...
BlendType.NORMAL.
def normal(background: np.ndarray, foreground: np.ndarray) -> np.ndarray: ...
BlendType.OVERLAY.
def overlay(background: np.ndarray, foreground: np.ndarray) -> np.ndarray: ...
BlendType.PINLIGHT.
def pinlight(background: np.ndarray, foreground: np.ndarray) -> np.ndarray: ...
BlendType.REFLECT.
def reflect(background: np.ndarray, foreground: np.ndarray) -> np.ndarray: ...
BlendType.SATURATION.
def saturation(background: np.ndarray, foreground: np.ndarray) -> np.ndarray: ...
BlendType.SCREEN.
def screen(background: np.ndarray, foreground: np.ndarray) -> np.ndarray: ...
BlendType.SOFTLIGHT.
def softlight(background: np.ndarray, foreground: np.ndarray) -> np.ndarray: ...
Place the layer below above the 'layer above' in places where the 'layer above' exists.
def srcatop(
backgroundAlpha: np.ndarray,
foregroundAlpha: np.ndarray,
backgroundColour: np.ndarray,
foregroundColour: np.ndarray,
) -> tuple[np.ndarray, np.ndarray]: ...
BlendType.VIVIDLIGHT.
def vividlight(background: np.ndarray, foreground: np.ndarray) -> np.ndarray: ...
BlendType.XOR.
def xor(background: np.ndarray, foreground: np.ndarray) -> np.ndarray: ...