blend_modes package

Submodules

blend_modes.blend_modes module

blend_modes.blend_modes.addition(img_in, img_layer, opacity)

Apply addition blending mode of a layer on an image.

Find more information on Wikipedia.

Example:

import img_filters_c, cv2
img_in = cv2.imread('./orig.png', -1).astype(float)
img_layer = cv2.imread('./layer.png', -1).astype(float)
img_out = addition(img_in,img_layer,0.5)
cv2.imshow('window', img_out)
cv2.waitKey()
Parameters:
  • img_in (3-dimensional numpy array of floats (r/g/b/a) in range 0-255.0) – Image to be blended upon
  • img_layer (3-dimensional numpy array of floats (r/g/b/a) in range 0.0-255.0) – Layer to be blended with image
  • opacity (float) – Desired opacity of layer for blending
Returns:

Blended image

Return type:

3-dimensional numpy array of floats (r/g/b/a) in range 0.0-255.0

blend_modes.blend_modes.darken_only(img_in, img_layer, opacity)

Apply darken only blending mode of a layer on an image.

Find more information on Wikipedia.

Example:

import img_filters_c, cv2
img_in = cv2.imread('./orig.png', -1).astype(float)
img_layer = cv2.imread('./layer.png', -1).astype(float)
img_out = darken_only(img_in,img_layer,0.5)
cv2.imshow('window', img_out)
cv2.waitKey()
Parameters:
  • img_in (3-dimensional numpy array of floats (r/g/b/a) in range 0-255.0) – Image to be blended upon
  • img_layer (3-dimensional numpy array of floats (r/g/b/a) in range 0.0-255.0) – Layer to be blended with image
  • opacity (float) – Desired opacity of layer for blending
Returns:

Blended image

Return type:

3-dimensional numpy array of floats (r/g/b/a) in range 0.0-255.0

blend_modes.blend_modes.difference(img_in, img_layer, opacity)

Apply difference blending mode of a layer on an image.

Find more information on Wikipedia.

Example:

import img_filters_c, cv2
img_in = cv2.imread('./orig.png', -1).astype(float)
img_layer = cv2.imread('./layer.png', -1).astype(float)
img_out = difference(img_in,img_layer,0.5)
cv2.imshow('window', img_out)
cv2.waitKey()
Parameters:
  • img_in (3-dimensional numpy array of floats (r/g/b/a) in range 0-255.0) – Image to be blended upon
  • img_layer (3-dimensional numpy array of floats (r/g/b/a) in range 0.0-255.0) – Layer to be blended with image
  • opacity (float) – Desired opacity of layer for blending
Returns:

Blended image

Return type:

3-dimensional numpy array of floats (r/g/b/a) in range 0.0-255.0

blend_modes.blend_modes.divide(img_in, img_layer, opacity)

Apply divide blending mode of a layer on an image.

Find more information on Wikipedia.

Example:

import img_filters_c, cv2
img_in = cv2.imread('./orig.png', -1).astype(float)
img_layer = cv2.imread('./layer.png', -1).astype(float)
img_out = divide(img_in,img_layer,0.5)
cv2.imshow('window', img_out)
cv2.waitKey()
Parameters:
  • img_in (3-dimensional numpy array of floats (r/g/b/a) in range 0-255.0) – Image to be blended upon
  • img_layer (3-dimensional numpy array of floats (r/g/b/a) in range 0.0-255.0) – Layer to be blended with image
  • opacity (float) – Desired opacity of layer for blending
Returns:

Blended image

Return type:

3-dimensional numpy array of floats (r/g/b/a) in range 0.0-255.0

blend_modes.blend_modes.dodge(img_in, img_layer, opacity)

Apply dodge blending mode of a layer on an image.

Find more information on Wikipedia.

Example:

import img_filters_c, cv2
img_in = cv2.imread('./orig.png', -1).astype(float)
img_layer = cv2.imread('./layer.png', -1).astype(float)
img_out = dodge(img_in,img_layer,0.5)
cv2.imshow('window', img_out)
cv2.waitKey()
Parameters:
  • img_in (3-dimensional numpy array of floats (r/g/b/a) in range 0-255.0) – Image to be blended upon
  • img_layer (3-dimensional numpy array of floats (r/g/b/a) in range 0.0-255.0) – Layer to be blended with image
  • opacity (float) – Desired opacity of layer for blending
Returns:

Blended image

Return type:

3-dimensional numpy array of floats (r/g/b/a) in range 0.0-255.0

blend_modes.blend_modes.grain_extract(img_in, img_layer, opacity)

Apply grain extract blending mode of a layer on an image.

Find more information on the KDE UserBase Wiki.

Example:

import img_filters_c, cv2
img_in = cv2.imread('./orig.png', -1).astype(float)
img_layer = cv2.imread('./layer.png', -1).astype(float)
img_out = grain_extract(img_in,img_layer,0.5)
cv2.imshow('window', img_out)
cv2.waitKey()
Parameters:
  • img_in (3-dimensional numpy array of floats (r/g/b/a) in range 0-255.0) – Image to be blended upon
  • img_layer (3-dimensional numpy array of floats (r/g/b/a) in range 0.0-255.0) – Layer to be blended with image
  • opacity (float) – Desired opacity of layer for blending
Returns:

Blended image

Return type:

3-dimensional numpy array of floats (r/g/b/a) in range 0.0-255.0

blend_modes.blend_modes.grain_merge(img_in, img_layer, opacity)

Apply grain merge blending mode of a layer on an image.

Find more information on the KDE UserBase Wiki.

Example:

import img_filters_c, cv2
img_in = cv2.imread('./orig.png', -1).astype(float)
img_layer = cv2.imread('./layer.png', -1).astype(float)
img_out = grain_merge(img_in,img_layer,0.5)
cv2.imshow('window', img_out)
cv2.waitKey()
Parameters:
  • img_in (3-dimensional numpy array of floats (r/g/b/a) in range 0-255.0) – Image to be blended upon
  • img_layer (3-dimensional numpy array of floats (r/g/b/a) in range 0.0-255.0) – Layer to be blended with image
  • opacity (float) – Desired opacity of layer for blending
Returns:

Blended image

Return type:

3-dimensional numpy array of floats (r/g/b/a) in range 0.0-255.0

blend_modes.blend_modes.hard_light(img_in, img_layer, opacity)

Apply hard light blending mode of a layer on an image.

Find more information on Wikipedia.

Example:

import img_filters_c, cv2
img_in = cv2.imread('./orig.png', -1).astype(float)
img_layer = cv2.imread('./layer.png', -1).astype(float)
img_out = hard_light(img_in,img_layer,0.5)
cv2.imshow('window', img_out)
cv2.waitKey()
Parameters:
  • img_in (3-dimensional numpy array of floats (r/g/b/a) in range 0-255.0) – Image to be blended upon
  • img_layer (3-dimensional numpy array of floats (r/g/b/a) in range 0.0-255.0) – Layer to be blended with image
  • opacity (float) – Desired opacity of layer for blending
Returns:

Blended image

Return type:

3-dimensional numpy array of floats (r/g/b/a) in range 0.0-255.0

blend_modes.blend_modes.lighten_only(img_in, img_layer, opacity)

Apply lighten only blending mode of a layer on an image.

Find more information on Wikipedia.

Example:

import img_filters_c, cv2
img_in = cv2.imread('./orig.png', -1).astype(float)
img_layer = cv2.imread('./layer.png', -1).astype(float)
img_out = lighten_only(img_in,img_layer,0.5)
cv2.imshow('window', img_out)
cv2.waitKey()
Parameters:
  • img_in (3-dimensional numpy array of floats (r/g/b/a) in range 0-255.0) – Image to be blended upon
  • img_layer (3-dimensional numpy array of floats (r/g/b/a) in range 0.0-255.0) – Layer to be blended with image
  • opacity (float) – Desired opacity of layer for blending
Returns:

Blended image

Return type:

3-dimensional numpy array of floats (r/g/b/a) in range 0.0-255.0

blend_modes.blend_modes.multiply(img_in, img_layer, opacity)

Apply multiply blending mode of a layer on an image.

Find more information on Wikipedia.

Example:

import img_filters_c, cv2
img_in = cv2.imread('./orig.png', -1).astype(float)
img_layer = cv2.imread('./layer.png', -1).astype(float)
img_out = multiply(img_in,img_layer,0.5)
cv2.imshow('window', img_out)
cv2.waitKey()
Parameters:
  • img_in (3-dimensional numpy array of floats (r/g/b/a) in range 0-255.0) – Image to be blended upon
  • img_layer (3-dimensional numpy array of floats (r/g/b/a) in range 0.0-255.0) – Layer to be blended with image
  • opacity (float) – Desired opacity of layer for blending
Returns:

Blended image

Return type:

3-dimensional numpy array of floats (r/g/b/a) in range 0.0-255.0

blend_modes.blend_modes.screen(img_in, img_layer, opacity)

Apply screen blending mode of a layer on an image.

Find more information on Wikipedia.

Example:

import img_filters_c, cv2
img_in = cv2.imread('./orig.png', -1).astype(float)
img_layer = cv2.imread('./layer.png', -1).astype(float)
img_out = screen(img_in,img_layer,0.5)
cv2.imshow('window', img_out)
cv2.waitKey()
Parameters:
  • img_in (3-dimensional numpy array of floats (r/g/b/a) in range 0-255.0) – Image to be blended upon
  • img_layer (3-dimensional numpy array of floats (r/g/b/a) in range 0.0-255.0) – Layer to be blended with image
  • opacity (float) – Desired opacity of layer for blending
Returns:

Blended image

Return type:

3-dimensional numpy array of floats (r/g/b/a) in range 0.0-255.0

blend_modes.blend_modes.soft_light(img_in, img_layer, opacity)

Apply soft light blending mode of a layer on an image.

Find more information on Wikipedia.

Example:

import img_filters_c, cv2
img_in = cv2.imread('./orig.png', -1).astype(float)
img_layer = cv2.imread('./layer.png', -1).astype(float)
img_out = soft_light(img_in,img_layer,0.5)
cv2.imshow('window', img_out)
cv2.waitKey()
Parameters:
  • img_in (3-dimensional numpy array of floats (r/g/b/a) in range 0-255.0) – Image to be blended upon
  • img_layer (3-dimensional numpy array of floats (r/g/b/a) in range 0.0-255.0) – Layer to be blended with image
  • opacity (float) – Desired opacity of layer for blending
Returns:

Blended image

Return type:

3-dimensional numpy array of floats (r/g/b/a) in range 0.0-255.0

blend_modes.blend_modes.subtract(img_in, img_layer, opacity)

Apply subtract blending mode of a layer on an image.

Find more information on Wikipedia.

Example:

import img_filters_c, cv2
img_in = cv2.imread('./orig.png', -1).astype(float)
img_layer = cv2.imread('./layer.png', -1).astype(float)
img_out = subtract(img_in,img_layer,0.5)
cv2.imshow('window', img_out)
cv2.waitKey()
Parameters:
  • img_in (3-dimensional numpy array of floats (r/g/b/a) in range 0-255.0) – Image to be blended upon
  • img_layer (3-dimensional numpy array of floats (r/g/b/a) in range 0.0-255.0) – Layer to be blended with image
  • opacity (float) – Desired opacity of layer for blending
Returns:

Blended image

Return type:

3-dimensional numpy array of floats (r/g/b/a) in range 0.0-255.0

Module contents