ImageEffect

class mpl_visual_context.image_effect.AlphaAxb(alpha_ab)

Bases: ChainableImageEffect

Modify the alpha channel by element-wise operation of ‘a * c + b’ where a, b is given and c is a alpha value from the image.

Methods

get_pad

process_image

get_pad()
process_image(dpi, scale_factor, x, y, img)
class mpl_visual_context.image_effect.ChainableImageEffect

Bases: ImageEffectBase

Methods

process_image

class mpl_visual_context.image_effect.ChainedImageEffect(ie1: ChainableImageEffect, ie2: ChainableImageEffect)

Bases: ChainableImageEffect

Methods

process_image

process_image(dpi, scale_factor, x, y, img)
class mpl_visual_context.image_effect.Dilation(size, channel_slice=slice(3, None, None))

Bases: ImageConvBase

grey dilation of the image

Methods

process_image

class mpl_visual_context.image_effect.Erosion(size, channel_slice=slice(3, None, None))

Bases: ImageConvBase

grey erosion of the image

Methods

process_image

class mpl_visual_context.image_effect.Fill(c)

Bases: ChainableImageEffect

fill the rgb chanell with given color. alpha channel is not affected

Methods

process_image

process_image(dpi, scale_factor, x, y, img)
class mpl_visual_context.image_effect.Gaussian(size, channel_slice=slice(3, None, None))

Bases: ImageConvBase

gaussian smoothed image

Methods

process_image

mpl_visual_context.image_effect.GaussianBlur

alias of Gaussian

class mpl_visual_context.image_effect.ImageConvBase(size, channel_slice=slice(3, None, None))

Bases: ChainableImageEffect

Methods

process_image

process_image(dpi, scale_factor, x, y, img)
class mpl_visual_context.image_effect.ImageEffectBase

Bases: ABC

Methods

process_image

abstract process_image(dpi, scale_factor, x, y, img)
class mpl_visual_context.image_effect.LightSource(erosion_size=3, gaussian_size=3, fraction=1, vert_exag=1, blend_mode='overlay', azdeg=315, altdeg=45)

Bases: LightSourceBase

apply lightsource effect to the image using its alpha channel (gaussian smoothed) as elevation

Methods

get_elev

process_image

get_elev(dpi, scale_factor, x, y, img)
class mpl_visual_context.image_effect.LightSourceBase(fraction=1, vert_exag=1, blend_mode='overlay', azdeg=315, altdeg=45)

Bases: ChainableImageEffect

Methods

get_elev

process_image

abstract get_elev(dpi, scale_factor, x, y, img)
process_image(dpi, scale_factor, x, y, img)
class mpl_visual_context.image_effect.LightSourceSharp(dist_max=None, dist_min=0, fraction=1, blend_mode='overlay', vert_exag=1, azdeg=315, altdeg=45)

Bases: LightSourceBase

apply lightsource effect to the image. The elevation is calculated by the distance transform of the alpha channel.

Methods

get_elev

process_image

get_elev(dpi, scale_factor, x, y, img)
class mpl_visual_context.image_effect.Offset(ox, oy)

Bases: ChainableImageEffect

translate the image by the given offset

Methods

process_image

process_image(dpi, scale_factor, x, y, img)
class mpl_visual_context.image_effect.Pad(pad, pady=None, *, rgb_fill=1.0, alpha_fill=0.0)

Bases: ChainableImageEffect

pad the image by given numberof pixels.

Methods

get_pad

process_image

get_pad()
process_image(dpi, scale_factor, x, y, img)