Skip to content

Filters

Pixlet provides a number of image filters that can be applied to widgets. Most filters are wrappers around the bild library.

To use these filters, you need to load the filter module:

load("filter.star", "filter")

Blur

Blur applies a Gaussian blur to the child widget.

Attributes

Name Type Description Required
child Widget The widget to apply the blur to. Y
radius float / int The radius of the Gaussian blur. Y

Example

filter.Blur(
    child = render.Image(src="...", width=64, height=64),
    radius = 2.0,
)
Blur Example

Brightness

Brightness adjusts the brightness of the child widget.

Attributes

Name Type Description Required
child Widget The widget to adjust brightness for. Y
change float / int The amount to change brightness by. -1.0 is black, 1.0 is white, 0.0 is no change. Y

Example

filter.Brightness(
    child = render.Image(src="...", width=64, height=64),
    change = -0.5,
)
Brightness Example

Contrast

Contrast adjusts the contrast of the child widget.

Attributes

Name Type Description Required
child Widget The widget to adjust contrast for. Y
factor float / int The factor to adjust contrast by. -1.0 is gray, 1.0 is no change, > 1.0 increases contrast. Y

Example

filter.Contrast(
    child = render.Image(src="...", width=64, height=64),
    factor = 2.0,
)
Contrast Example

EdgeDetection

EdgeDetection applies an edge detection filter to the child widget.

Attributes

Name Type Description Required
child Widget The widget to detect edges on. Y
radius float / int The radius of the edge detection kernel. Y

Example

filter.EdgeDetection(
    child = render.Image(src="...", width=64, height=64),
    radius = 2.0,
)
EdgeDetection Example

Emboss

Emboss applies an emboss filter to the child widget.

Attributes

Name Type Description Required
child Widget The widget to emboss. Y

Example

filter.Emboss(
    child = render.Image(src="...", width=64, height=64),
)
Emboss Example

FlipHorizontal

FlipHorizontal flips the child widget horizontally.

Attributes

Name Type Description Required
child Widget The widget to flip. Y

Example

filter.FlipHorizontal(
    child = render.Image(src="...", width=64, height=64),
)
FlipHorizontal Example

FlipVertical

FlipVertical flips the child widget vertically.

Attributes

Name Type Description Required
child Widget The widget to flip. Y

Example

filter.FlipVertical(
    child = render.Image(src="...", width=64, height=64),
)
FlipVertical Example

Gamma

Gamma applies gamma correction to the child widget.

Attributes

Name Type Description Required
child Widget The widget to apply gamma correction to. Y
gamma float / int The gamma value. 1.0 is no change, < 1.0 darkens, > 1.0 lightens. Y

Example

filter.Gamma(
    child = render.Image(src="...", width=64, height=64),
    gamma = 0.5,
)
Gamma Example

Grayscale

Grayscale converts the child widget to grayscale.

Attributes

Name Type Description Required
child Widget The widget to convert to grayscale. Y

Example

filter.Grayscale(
    child = render.Image(src="...", width=64, height=64),
)
Grayscale Example

Hue

Hue adjusts the hue of the child widget.

Attributes

Name Type Description Required
child Widget The widget to adjust hue for. Y
change float / int The amount to change hue by in degrees. Y

Example

filter.Hue(
    child = render.Image(src="...", width=64, height=64),
    change = 180.0,
)
Hue Example

Invert

Invert inverts the colors of the child widget.

Attributes

Name Type Description Required
child Widget The widget to invert. Y

Example

filter.Invert(
    child = render.Image(src="...", width=64, height=64),
)
Invert Example

Rotate

Rotate rotates the child widget by the specified angle.

Attributes

Name Type Description Required
child Widget The widget to rotate. Y
angle float / int The angle to rotate by in degrees. Y

Example

filter.Rotate(
    child = render.Image(src="...", width=64, height=64),
    angle = 10.0,
)
Rotate Example

Saturation

Saturation adjusts the saturation of the child widget.

Attributes

Name Type Description Required
child Widget The widget to adjust saturation for. Y
factor float / int The factor to adjust saturation by. 0.0 is grayscale, 1.0 is no change, > 1.0 increases saturation. Y

Example

filter.Saturation(
    child = render.Image(src="...", width=64, height=64),
    factor = 1,
)
Saturation Example

Sepia

Sepia applies a sepia filter to the child widget.

Attributes

Name Type Description Required
child Widget The widget to apply sepia to. Y

Example

filter.Sepia(
    child = render.Image(src="...", width=64, height=64),
)
Sepia Example

Sharpen

Sharpen sharpens the child widget.

Attributes

Name Type Description Required
child Widget The widget to sharpen. Y

Example

filter.Sharpen(
    child = render.Image(src="...", width=64, height=64),
)
Sharpen Example

Shear

Shear shears the child widget horizontally and/or vertically.

Attributes

Name Type Description Required
child Widget The widget to shear. Y
x_angle float / int The angle to shear horizontally in degrees. N
y_angle float / int The angle to shear vertically in degrees. N

Example

filter.Shear(
    child = render.Image(src="...", width=64, height=64),
    x_angle = 10.0,
)
Shear Example

Threshold

Threshold applies a threshold filter to the child widget, making it black and white.

Attributes

Name Type Description Required
child Widget The widget to apply threshold to. Y
level float / int The threshold level, from 0 to 255. Y

Example

filter.Threshold(
    child = render.Image(src="...", width=64, height=64),
    level = 128.0,
)
Threshold Example