Noisemaker API

Images are float32 tensors (0..1 range), with shape (height, width, channels). Most functions assume seamlessly tiled noise.

This is a pre-1.0 API, and may receive backwards incompatible changes.

noisemaker.generators

noisemaker.generators.basic(freq, shape, ridges=False, sin=0.0, wavelet=False, spline_order=3, seed=None, distrib=<ValueDistribution.normal: 0>, corners=False, mask=None, lattice_drift=0.0, rgb=False, hue_range=0.125, hue_rotation=None, saturation=1.0, brightness_distrib=None, saturation_distrib=None, **post_process_args)[source]

Generate a single layer of scaled noise.

Noisemaker example output (CC0)
Parameters:
  • freq (int|list[int]) – Base noise frequency. Int, or list of ints for each spatial dimension
  • list[int] – Shape of noise. For 2D noise, this is [height, width, channels]
  • ridges (bool) – “Crease” at midpoint values: (1 - abs(n * 2 - 1))
  • sin (float) – Apply sin function to noise basis
  • wavelet (bool) – Maybe not wavelets this time?
  • spline_order (int) – Spline point count. 0=Constant, 1=Linear, 2=Cosine, 3=Bicubic
  • distrib (int|str|ValueDistribution) – Type of noise distribution. See ValueDistribution enum
  • corners (bool) – If True, pin values to corners instead of image center
  • mask (None|ValueMask) –
  • lattice_drift (float) – Push away from underlying lattice
  • seed (int) – Random seed for reproducible output. Ineffective with exp
  • rgb (bool) – Disable HSV
  • hue_range (float) – HSV hue range
  • hue_rotation (float|None) – HSV hue bias
  • saturation (float) – HSV saturation
  • saturation_distrib (None|int|str|ValueDistribution) – Override ValueDistribution for saturation
  • brightness_distrib (None|int|str|ValueDistribution) – Override ValueDistribution for brightness
Returns:

Tensor

Additional keyword args will be sent to noisemaker.effects.post_process()

noisemaker.generators.multires(freq=3, shape=None, octaves=4, ridges=False, post_ridges=False, sin=0.0, wavelet=False, spline_order=3, seed=None, reflect_range=0.0, refract_range=0.0, reindex_range=0.0, distrib=<ValueDistribution.normal: 0>, corners=False, mask=None, deriv=False, deriv_func=0, deriv_alpha=1.0, lattice_drift=0.0, post_reflect_range=0.0, post_refract_range=0.0, post_deriv=False, with_reverb=None, reverb_iterations=1, rgb=False, hue_range=0.125, hue_rotation=None, saturation=1.0, saturation_distrib=None, brightness_distrib=None, **post_process_args)[source]

Generate multi-resolution value noise. For each octave: freq increases, amplitude decreases.

Noisemaker example output (CC0)
Parameters:
  • freq (int|list[int]) – Bottom layer frequency. Int, or list of ints for each spatial dimension
  • list[int] – Shape of noise. For 2D noise, this is [height, width, channels]
  • octaves (int) – Octave count. Number of multi-res layers. Typically 1-8
  • ridges (bool) – Per-octave “crease” at midpoint values: (1 - abs(n * 2 - 1))
  • post_ridges (bool) – Post-reduce “crease” at midpoint values: (1 - abs(n * 2 - 1))
  • sin (float) – Apply sin function to noise basis
  • wavelet (bool) – Maybe not wavelets this time?
  • spline_order (int) – Spline point count. 0=Constant, 1=Linear, 2=Cosine, 3=Bicubic
  • seed (int) – Random seed for reproducible output. Ineffective with exponential
  • reflect_range (float) – Per-octave derivative-based distort gradient
  • refract_range (float) – Per-octave self-distort gradient
  • reindex_range (float) – Per-octave self-reindexing gradient
  • with_reverb (None|int) – Post-reduce tiled octave count
  • reverb_iterations (int) – Re-reverberate N times
  • distrib (int|ValueDistribution) – Type of noise distribution. See ValueDistribution enum
  • corners (bool) – If True, pin values to corners instead of image center
  • mask (None|ValueMask) –
  • deriv (bool) – Extract derivatives from noise
  • deriv_func (DistanceFunction|int) – Derivative distance function
  • deriv_alpha (float) – Derivative alpha blending amount
  • lattice_drift (float) – Push away from underlying lattice
  • post_reflect_range (float) – Reduced derivative-based distort gradient
  • post_refract_range (float) – Reduced self-distort gradient
  • post_deriv (bool) – Reduced derivatives
  • rgb (bool) – Disable HSV
  • hue_range (float) – HSV hue range
  • hue_rotation (float|None) – HSV hue bias
  • saturation (float) – HSV saturation
  • saturation_distrib (None|ValueDistribution) – Override ValueDistribution for HSV saturation
  • brightness_distrib (None|ValueDistribution) – Override ValueDistribution for HSV brightness
Returns:

Tensor

Additional keyword args will be sent to noisemaker.effects.post_process()

noisemaker.generators.values(freq, shape, distrib=<ValueDistribution.normal: 0>, corners=False, mask=None, spline_order=3, seed=None, wavelet=False)[source]

noisemaker.effects

noisemaker.effects.aberration(tensor, shape, displacement=0.005)[source]

Chromatic aberration

Parameters:
  • tensor (Tensor) –
  • shape (list[int]) –
  • displacement (float) –
noisemaker.effects.blend(a, b, g)[source]

Blend a and b values with linear interpolation.

Parameters:
  • a (Tensor) –
  • b (Tensor) –
  • g (float|Tensor) – Blending gradient a to b (0..1)
Return Tensor:
noisemaker.effects.blend_cosine(a, b, g)[source]

Blend a and b values with cosine interpolation.

Parameters:
  • a (Tensor) –
  • b (Tensor) –
  • g (float|Tensor) – Blending gradient a to b (0..1)
Return Tensor:
noisemaker.effects.blend_cubic(a, b, c, d, g)[source]

Blend b and c values with bi-cubic interpolation.

Parameters:
  • a (Tensor) –
  • b (Tensor) –
  • c (Tensor) –
  • d (Tensor) –
  • g (float|Tensor) – Blending gradient b to c (0..1)
Return Tensor:
noisemaker.effects.blend_layers(control, shape, *layers)[source]
noisemaker.effects.bloom(tensor, shape, alpha=0.5)[source]

Bloom effect

Parameters:
  • tensor (Tensor) –
  • shape (list[int]) –
  • alpha (float) –
noisemaker.effects.center_mask(center, edges, shape)[source]

Blend two image tensors from the center to the edges.

Parameters:
  • center (Tensor) –
  • edges (Tensor) –
  • shape (list[int]) –
Returns:

Tensor

noisemaker.effects.color_map(tensor, clut, shape, horizontal=False, displacement=0.5)[source]

Apply a color map to an image tensor.

The color map can be a photo or whatever else.

Noisemaker example output (CC0)
Parameters:
  • tensor (Tensor) –
  • clut (Tensor|str) – An image tensor or filename (png/jpg only) to use as a color palette
  • shape (list[int]) –
  • horizontal (bool) – Scan horizontally
  • displacement (float) – Gather distance for clut
noisemaker.effects.column_index(shape)[source]

Generate a Y index for the given tensor.

[
  [ 0, 0, 0, ... ],
  [ 1, 1, 1, ... ],
  [ n, n, n, ... ],
  ...
  [ height-1, height-1, height-1, ... ]
]
Parameters:shape (list[int]) –
Returns:Tensor
noisemaker.effects.conv_feedback(tensor, shape, iterations=50, alpha=0.5)[source]

Conv2d feedback loop

Parameters:tensor (Tensor) –
Returns:Tensor
noisemaker.effects.convolve(kernel, tensor, shape, with_normalize=True, alpha=1.0)[source]

Apply a convolution kernel to an image tensor.

Parameters:
  • kernel (ConvKernel) – See ConvKernel enum
  • tensor (Tensor) – An image tensor.
  • shape (list[int]) –
  • with_normalize (bool) – Normalize output (True)
Paral float alpha:
 

Alpha blending amount

Returns:

Tensor

noisemaker.effects.crease(tensor)[source]

Create a “crease” (ridge) at midpoint values. 1 - abs(n * 2 - 1)

Noisemaker example output (CC0)
Parameters:tensor (Tensor) – An image tensor.
Returns:Tensor
noisemaker.effects.density_map(tensor, shape)[source]
noisemaker.effects.derivative(tensor, shape, dist_func=1, with_normalize=True, alpha=1.0)[source]

Extract a derivative from the given noise.

Noisemaker example output (CC0)
Parameters:
  • tensor (Tensor) –
  • shape (list[int]) –
  • dist_func (DistanceFunction|int) – Derivative distance function
  • with_normalize (bool) –
Returns:

Tensor

noisemaker.effects.distance(a, b, func)[source]

Compute the distance from a to b, using the specified function.

Parameters:
  • a (Tensor) –
  • b (Tensor) –
  • func (DistanceFunction|int|str) – Distance function (1=Euclidean, 2=Manhattan, 3=Chebyshev)
Returns:

Tensor

noisemaker.effects.dla(tensor, shape, padding=2, seed_density=0.01, density=0.125, xy=None)[source]
noisemaker.effects.erode(tensor, shape, density=50, iterations=50, contraction=1.0, alpha=0.25, inverse=False, xy_blend=False)[source]

WIP hydraulic erosion effect.

noisemaker.effects.expand_tile(tensor, input_shape, output_shape)[source]
noisemaker.effects.freq_for_shape(freq, shape)[source]

Given a base frequency as int, generate noise frequencies for each spatial dimension.

Parameters:
  • freq (int) – Base frequency
  • shape (list[int]) – List of spatial dimensions, e.g. [height, width]
noisemaker.effects.inner_tile(tensor, shape, freq)[source]
noisemaker.effects.jpeg_decimate(tensor, shape, iterations=25)[source]

JPEG decimation with conv2d feedback loop

Parameters:tensor (Tensor) –
Returns:Tensor
noisemaker.effects.light_leak(tensor, shape, alpha=0.25)[source]
noisemaker.effects.morph(a, b, g, dist_func=<DistanceFunction.euclidean: 1>, spline_order=1)[source]

Linear or cosine interpolation using a specified distance function

Parameters:
  • a (Tensor) –
  • b (Tensor) –
  • g (float|Tensor) – Blending gradient a to b (0..1)
  • dist_func (DistanceFunction|int|str) – Distance function (1=Euclidean, 2=Manhattan, 3=Chebyshev)
  • spline_order (int) – 1=Linear, 2=Cosine
noisemaker.effects.normal_map(tensor, shape)[source]

Generate a tangent-space normal map.

Parameters:
  • tensor (Tensor) –
  • shape (list[int]) –
Returns:

Tensor

noisemaker.effects.normalize(tensor)[source]

Squeeze the given Tensor into a range between 0 and 1.

Parameters:tensor (Tensor) – An image tensor.
Returns:Tensor
noisemaker.effects.offset(tensor, shape, x=0, y=0)[source]
noisemaker.effects.offset_index(y_index, height, x_index, width)[source]

Offset X and Y displacement channels from each other, to help with diagonal banding.

Returns a combined Tensor with shape [height, width, 2]

Parameters:
  • y_index (Tensor) – Tensor with shape [height, width, 1], containing Y indices
  • height (int) –
  • x_index (Tensor) – Tensor with shape [height, width, 1], containing X indices
  • width (int) –
Returns:

Tensor

noisemaker.effects.outline(tensor, shape, sobel_func=1)[source]

Superimpose sobel operator results (cartoon edges)

Parameters:
  • tensor (Tensor) –
  • shape (list[int]) –
  • sobel_func (DistanceFunction|int) – Sobel distance function
noisemaker.effects.pop(tensor, shape)[source]

Pop art filter

Parameters:
  • tensor (Tensor) –
  • shape (list[int]) –
noisemaker.effects.post_process(tensor, shape, freq, ridges_hint=False, spline_order=3, reflect_range=0.0, refract_range=0.0, reindex_range=0.0, clut=None, clut_horizontal=False, clut_range=0.5, with_worms=None, worms_density=4.0, worms_duration=4.0, worms_stride=1.0, worms_stride_deviation=0.05, worms_alpha=0.5, worms_kink=1.0, with_sobel=None, with_normal_map=False, deriv=None, deriv_alpha=1.0, with_outline=False, with_wormhole=False, wormhole_kink=2.5, wormhole_stride=0.1, wormhole_alpha=1.0, with_voronoi=0, voronoi_nth=0, voronoi_func=1, voronoi_alpha=1.0, voronoi_refract=0.0, voronoi_inverse=False, posterize_levels=0, with_erosion_worms=False, erosion_worms_density=50, erosion_worms_iterations=50, erosion_worms_contraction=1.0, erosion_worms_alpha=1.0, erosion_worms_inverse=False, erosion_worms_xy_blend=None, warp_range=0.0, warp_octaves=3, warp_interp=None, warp_freq=None, ripple_range=0.0, ripple_freq=None, ripple_kink=1.0, vortex_range=0.0, with_pop=False, with_aberration=None, with_dla=0.0, dla_padding=2, point_freq=5, point_distrib=0, point_corners=False, point_generations=1, point_drift=0.0, with_bloom=None, with_reverb=None, reverb_iterations=1, reverb_ridges=True, with_light_leak=None, with_vignette=None, vignette_brightness=0.0, post_hue_rotation=None, post_saturation=None, post_contrast=None, input_dir=None, with_crease=False, with_shadow=None, with_jpeg_decimate=None, with_conv_feedback=None, conv_feedback_alpha=0.5, with_density_map=False, **convolve_kwargs)[source]

Apply post-processing effects.

Parameters:
  • tensor (Tensor) –
  • shape (list[int]) –
  • freq (list[int]) –
  • spline_order (int) – Ortho spline point count (0=Constant, 1=Linear, 2=Cosine, 3=Bicubic)
  • reflect_range (float) – Derivative distortion gradient.
  • refract_range (float) – Self-distortion gradient.
  • reindex_range (float) – Self-reindexing gradient.
  • clut (str) – PNG or JPG color lookup table filename.
  • clut_horizontal (float) – Preserve clut Y axis.
  • clut_range (float) – Gather range for clut.
  • with_worms (WormBehavior|None) – Do worms.
  • worms_density (float) – Worm density multiplier (larger == slower)
  • worms_duration (float) – Iteration multiplier (larger == slower)
  • worms_stride (float) – Mean travel distance per iteration
  • worms_stride_deviation (float) – Per-worm travel distance deviation
  • worms_alpha (float) – Fade worms (0..1)
  • worms_kink (float) – Worm twistiness
  • sobel (DistanceFunction|int) – Sobel operator distance function
  • outline (DistanceFunction|int) – Outlines distance function (multiply)
  • with_normal_map (bool) – Create a tangent-space normal map
  • with_wormhole (bool) – Wormhole effect. What is this?
  • wormhole_kink (float) – Wormhole kinkiness, if you’re into that.
  • wormhole_stride (float) – Wormhole thickness range
  • wormhole_alpha (float) – Wormhole alpha blending
  • with_voronoi (VoronoiDiagramType|int) – Voronoi diagram type (0=Off, 1=Range, 2=Color Range, 3=Indexed, 4=Color Map, 5=Blended, 6=Flow)
  • voronoi_nth (int) – Voronoi Nth nearest
  • voronoi_func (DistanceFunction|int) – Voronoi distance function
  • voronoi_alpha (float) – Blend with original tensor (0.0 = Original, 1.0 = Voronoi)
  • voronoi_refract (float) – Domain warp input tensor against Voronoi
  • voronoi_inverse (bool) – Inverse values for Voronoi ‘range’ types
  • ridges_hint (bool) – Ridged multifractal hint for Voronoi
  • deriv (DistanceFunction|int) – Derivative distance function
  • deriv_alpha (float) – Derivative distance function alpha blending amount
  • posterize_levels (float) – Posterize levels
  • with_erosion_worms (bool) – Erosion worms
  • erosion_worms_density (float) – Default: 50
  • erosion_worms_iterations (float) – Default: 50
  • erosion_worms_contraction (float) – Inverse of stride. Default: 1.0, smaller=longer steps
  • erosion_worms_alpha (float) –
  • erosion_worms_inverse (bool) –
  • erosion_worms_xy_blend (None|float) –
  • vortex_range (float) – Vortex tiling amount
  • warp_range (float) – Orthogonal distortion gradient.
  • warp_octaves (int) – Multi-res iteration count for warp
  • warp_interp (int|None) – Override spline order for warp (None = use spline_order)
  • warp_freq (int|None) – Override frequency for warp (None = use freq)
  • ripple_range (float) – Ripple range
  • ripple_freq (float) – Ripple frequency
  • ripple_kink (float) – Ripple twistiness
  • with_pop (bool) – Pop art filter
  • with_aberration (float|None) – Chromatic aberration distance
  • with_bloom (float|None) – Bloom alpha
  • with_dla (bool) – Diffusion-limited aggregation alpha
  • dla_padding (int) – DLA pixel padding
  • point_freq (int) – Voronoi and DLA point frequency (freq * freq = count)
  • point_distrib (PointDistribution|int) – Voronoi and DLA point cloud distribution
  • point_corners (bool) – Pin Voronoi and DLA points to corners (False = pin to center)
  • point_generations (int) – Penrose-ish generations. Keep it low, and keep freq low, or you will run OOM easily.
  • point_drift (float) – Fudge point locations (1.0 = nearest neighbor)
  • with_reverb (None|int) – Reverb octave count
  • reverb_iterations (int) – Re-reverberation N times
  • reverb_ridges (bool) – Ridged reverb layers (False to disable)
  • with_light_leak (None|float) – Light leak effect alpha
  • with_vignette (None|float) – Vignette effect alpha
  • vignette_brightness (None|float) – Vignette effect brightness
  • post_hue_rotation (None|float) – Rotate hue (-.5 - .5)
  • post_saturation (None|float) – Adjust saturation (0 - 1)
  • post_contrast (None|float) – Adjust contrast
  • input_dir (None|str) – Input directory containing .png and/or .jpg images, for collage functions.
  • with_crease (bool) – Crease at midpoint values
  • with_shadow (None|float) – Sobel-based shading alpha
  • with_jpeg_decimate (None|int) – Conv2D feedback + JPEG encode/decode iteration count
  • with_conv_feedback (None|int) – Conv2D feedback iterations
  • conv_feedback_alpha (float) – Conv2D feedback alpha
  • with_density_map (bool) – Map values to color histogram
Returns:

Tensor

noisemaker.effects.posterize(tensor, levels)[source]

Reduce the number of color levels per channel.

Parameters:
  • tensor (Tensor) –
  • levels (int) –
Returns:

Tensor

noisemaker.effects.refract(tensor, shape, displacement=0.5, reference_x=None, reference_y=None, warp_freq=None, spline_order=3, from_derivative=False)[source]

Apply displacement from pixel values.

Noisemaker example output (CC0)
Parameters:
  • tensor (Tensor) – An image tensor.
  • shape (list[int]) –
  • displacement (float) –
  • reference_x (Tensor) – An optional horizontal displacement map.
  • reference_y (Tensor) – An optional vertical displacement map.
  • warp_freq (list[int]) – If given, generate new reference_x and reference_y noise with this base frequency.
  • spline_order (int) – Ortho offset spline point count. 0=Constant, 1=Linear, 2=Cosine, 3=Bicubic
  • from_derivative (bool) – If True, generate X and Y offsets from noise derivatives.
Returns:

Tensor

noisemaker.effects.reindex(tensor, shape, displacement=0.5)[source]

Re-color the given tensor, by sampling along one axis at a specified frequency.

Noisemaker example output (CC0)
Parameters:
  • tensor (Tensor) – An image tensor.
  • shape (list[int]) –
  • displacement (float) –
Returns:

Tensor

noisemaker.effects.resample(tensor, shape, spline_order=3)[source]

Resize an image tensor to the specified shape.

Parameters:
  • tensor (Tensor) –
  • shape (list[int]) –
  • spline_order (int) – Spline point count. 0=Constant, 1=Linear, 2=Cosine, 3=Bicubic
Returns:

Tensor

noisemaker.effects.reverb(tensor, shape, octaves, iterations=1, ridges=True)[source]

Multi-octave “reverberation” of input image tensor

Parameters:
  • tensor (Tensor) –
  • shape (float[int]) –
  • octaves (int) –
  • iterations (int) – Re-reverberate N times. Gratuitous!
  • ridges (bool) – abs(tensor * 2 - 1) – False to not do that.
noisemaker.effects.ripple(tensor, shape, freq, displacement=1.0, kink=1.0, reference=None, spline_order=3)[source]

Apply displacement from pixel radian values.

Parameters:
  • tensor (Tensor) – An image tensor.
  • shape (list[int]) –
  • freq (list[int]) – Displacement frequency
  • displacement (float) –
  • kink (float) –
  • reference (Tensor) – An optional displacement map.
  • spline_order (int) – Ortho offset spline point count. 0=Constant, 1=Linear, 2=Cosine, 3=Bicubic
Returns:

Tensor

noisemaker.effects.row_index(shape)[source]

Generate an X index for the given tensor.

[
  [ 0, 1, 2, ... width-1 ],
  [ 0, 1, 2, ... width-1 ],
  ... (x height)
]
Parameters:shape (list[int]) –
Returns:Tensor
noisemaker.effects.shadow(tensor, shape, alpha=1.0)[source]
noisemaker.effects.singularity(tensor, shape, diagram_type=1, **kwargs)[source]

Return the range diagram for a single voronoi point, approximately centered.

Parameters:
  • shape (list[int]) –
  • dist_func (DistanceFunction|int) –
  • diagram_type (VoronoiDiagramType|int) –

Additional kwargs will be sent to the voronoi function.

noisemaker.effects.sobel(tensor, shape, dist_func=1)[source]

Apply a sobel operator.

Parameters:
  • tensor (Tensor) –
  • shape (list[int]) –
  • dist_func (DistanceFunction|int) – Sobel distance function
Returns:

Tensor

noisemaker.effects.value_map(tensor, shape, keep_dims=False)[source]

Create a grayscale value map from the given image Tensor by reducing the sum across channels.

Parameters:
  • tensor (Tensor) –
  • shape (list[int]) –
  • keep_dims (bool) – If True, don’t collapse the channel dimension.
noisemaker.effects.vignette(tensor, shape, brightness=0.0, alpha=1.0)[source]
noisemaker.effects.voronoi(tensor, shape, diagram_type=1, density=0.1, nth=0, dist_func=1, alpha=1.0, with_refract=0.0, inverse=False, xy=None, ridges_hint=False, input_dir=None, image_count=None, collage_images=None)[source]

Create a voronoi diagram, blending with input image Tensor color values.

Parameters:
  • tensor (Tensor) –
  • shape (list[int]) –
  • diagram_type (VoronoiDiagramType|int) – Diagram type (0=Off, 1=Range, 2=Color Range, 3=Indexed, 4=Color Map, 5=Blended, 6=Flow)
  • nth (float) – Plot Nth nearest neighbor, or -Nth farthest
  • dist_func (DistanceFunction|int) – Voronoi distance function (1=Euclidean, 2=Manhattan, 3=Chebyshev)
  • regions (bool) – Assign colors to control points (memory intensive)
  • alpha (float) – Blend with original tensor (0.0 = Original, 1.0 = Voronoi)
  • with_refract (float) – Domain warp input tensor against resulting voronoi
  • inverse (bool) – Invert range brightness values (does not affect hue)
  • Tensor, int) xy ((Tensor,) – Bring your own x, y, and point count (You shouldn’t normally need this)
  • ridges_hint (float) – Adjust output colors to match ridged multifractal output (You shouldn’t normally need this)
  • input_dir (str) – Input directory containing .jpg and/or .png images, if using collage mode
  • image_count (None|int) – Give an explicit image count for collages (Optional)
  • collage_images (None|list[Tensor]) – Give an explicit list of collage image tensors (Optional)
Returns:

Tensor

noisemaker.effects.vortex(tensor, shape, displacement=64.0)[source]

Vortex tiling effect

Parameters:
  • tensor (Tensor) –
  • shape (list[int]) –
  • displacement (float) –
noisemaker.effects.warp(tensor, shape, freq, octaves=5, displacement=1, spline_order=3)[source]
noisemaker.effects.wavelet(tensor, shape)[source]

Convert regular noise into 2-D wavelet noise.

Completely useless. Maybe useful if Noisemaker supports higher dimensions later.

Noisemaker example output (CC0)
Parameters:
  • tensor (Tensor) – An image tensor.
  • shape (list[int]) –
Returns:

Tensor

noisemaker.effects.wormhole(tensor, shape, kink, input_stride, alpha=1.0)[source]

Apply per-pixel field flow. Non-iterative.

Parameters:
  • tensor (Tensor) –
  • shape (list[int]) –
  • kink (float) – Path twistiness
  • input_stride (float) – Maximum pixel offset
Returns:

Tensor

noisemaker.effects.worms(tensor, shape, behavior=1, density=4.0, duration=4.0, stride=1.0, stride_deviation=0.05, alpha=0.5, kink=1.0, colors=None)[source]

Make a furry patch of worms which follow field flow rules.

Noisemaker example output (CC0)
Parameters:
  • tensor (Tensor) –
  • shape (list[int]) –
  • behavior (int|WormBehavior) –
  • density (float) – Worm density multiplier (larger == slower)
  • duration (float) – Iteration multiplier (larger == slower)
  • stride (float) – Mean travel distance per iteration
  • stride_deviation (float) – Per-worm travel distance deviation
  • alpha (float) – Fade worms (0..1)
  • kink (float) – Make your worms twist.
  • colors (Tensor) – Optional starting colors, if not from tensor.
Returns:

Tensor

noisemaker.presets

Presets library for artmaker/artmangler scripts

noisemaker.presets.load(preset_name, preset_set=None)[source]

Load a named preset. Specify “random” for a random preset.

Returns a tuple of (dict, dict, str): generators.multires keyword args, recipes.post_process keyword args, and preset name.

See the artmaker script for an example of how these values are used.

Parameters:
  • preset_name (str) – Name of the preset. If “random” is given, a random preset is returned.
  • preset_set (dict|None) – Use a provided preset set. Defaults to presets.PRESETS.
Returns:

tuple(dict, dict, str)

noisemaker.recipes

noisemaker.recipes.crt(tensor, shape)[source]

Apply vintage CRT snow and scanlines.

Parameters:
  • tensor (Tensor) –
  • shape (list[int]) –
noisemaker.recipes.dither(tensor, shape, amount)[source]
noisemaker.recipes.glitch(tensor, shape)[source]

Apply a glitch effect.

Parameters:
  • tensor (Tensor) –
  • shape (list[int]) –
Returns:

Tensor

noisemaker.recipes.post_process(tensor, freq=3, shape=None, with_glitch=False, with_vhs=False, with_crt=False, with_scan_error=False, with_snow=False, with_dither=False)[source]

Apply complex post-processing recipes.

Parameters:
  • tensor (Tensor) –
  • freq (int) –
  • shape (list[int]) –
  • with_glitch (bool) – Glitch effect (Bit shit)
  • with_vhs (bool) – VHS effect (Shitty tracking)
  • with_crt (bool) – Vintage TV effect
  • with_scan_error (bool) – Horizontal scan error
  • with_snow (float) – Analog broadcast snow
  • with_dither (float) – Per-pixel brightness jitter
Returns:

Tensor

noisemaker.recipes.scanline_error(tensor, shape)[source]
noisemaker.recipes.snow(tensor, shape, amount)[source]
noisemaker.recipes.vhs(tensor, shape)[source]

Apply a bad VHS tracking effect.

Parameters:
  • tensor (Tensor) –
  • shape (list[int]) –
Returns:

Tensor

noisemaker.constants

class noisemaker.constants.ConvKernel[source]

Bases: enum.Enum

A collection of convolution kernels for image post-processing, based on well-known recipes.

Pass the desired kernel as an argument to convolve().

image = convolve(ConvKernel.shadow, image)
blur = [[1, 4, 6, 4, 1], [4, 16, 24, 16, 4], [6, 24, 36, 24, 6], [4, 16, 24, 16, 4], [1, 4, 6, 4, 1]]
deriv_x = [[0, 0, 0], [0, -1, 1], [0, 0, 0]]
deriv_y = [[0, 0, 0], [0, -1, 0], [0, 1, 0]]
edges = [[1, 2, 1], [2, -12, 2], [1, 2, 1]]
emboss = [[0, 2, 4], [-2, 1, 2], [-4, -2, 0]]
invert = [[0, 0, 0], [0, -1, 0], [0, 0, 0]]
rand = <MagicMock name='mock.normal().tolist()' id='139739897119016'>
sharpen = [[0, -1, 0], [-1, 5, -1], [0, -1, 0]]
sobel_x = [[1, 0, -1], [2, 0, -2], [1, 0, -1]]
sobel_y = [[1, 2, 1], [0, 0, 0], [-1, -2, -1]]
class noisemaker.constants.DistanceFunction[source]

Bases: enum.Enum

Specify the distance function used in various operations, such as Voronoi cells, derivatives, and sobel operators.

chebyshev = 3
euclidean = 1
manhattan = 2
none = 0
class noisemaker.constants.InterpolationType[source]

Bases: enum.Enum

Specify the spline point count for interpolation operations.

bicubic = 3
constant = 0
cosine = 2
linear = 1
class noisemaker.constants.PointDistribution[source]

Bases: enum.Enum

Point cloud distribution, used by Voronoi and DLA

chess = 3
circular = 100
classmethod circular_members()[source]
concentric = 101
classmethod grid_members()[source]
h_hex = 10
classmethod is_circular(member)[source]
classmethod is_grid(member)[source]
random = 0
rotating = 102
spiral = 50
square = 1
v_hex = 11
waffle = 2
class noisemaker.constants.ValueDistribution[source]

Bases: enum.Enum

Specify the value distribution function for basic noise.

image = basic(freq, [height, width, channels], distrib=ValueDistribution.uniform)
exp = 2
laplace = 3
lognormal = 4
mids = 6
normal = 0
ones = 5
uniform = 1
class noisemaker.constants.ValueMask[source]

Bases: enum.Enum

chess = 3
classmethod grid_members()[source]
h_hex = 10
h_tri = 12
iching = 106
ideogram = 105
invaders = 101
invaders_square = 102
classmethod is_grid(member)[source]
classmethod is_procedural(member)[source]
letters = 104
matrix = 103
classmethod procedural_members()[source]
script = 107
sparse = 100
square = 1
v_hex = 11
v_tri = 13
waffle = 2
class noisemaker.constants.VoronoiDiagramType[source]

Bases: enum.Enum

Specify the artistic rendering function used for Voronoi diagrams.

collage = 8

Stitched collage based on indexed regions

color_range = 2

Normalized neighbor distances blended with input Tensor

color_regions = 4

Color-mapped regions

density = 7

Density-mapped flow diagram

flow = 6

Edgeless voronoi. Natural logarithm of reduced distance sums.

classmethod flow_members()[source]
classmethod is_flow_member(member)[source]
none = 0

No Voronoi

range = 1

Normalized neighbor distances

range_regions = 5

Colorized neighbor distances blended with color-mapped regions

regions = 3

Indexed regions

class noisemaker.constants.WormBehavior[source]

Bases: enum.Enum

Specify the type of heading bias for worms to follow.

image = worms(image, behavior=WormBehavior.unruly)
chaotic = 4
crosshatch = 2
none = 0
obedient = 1
random = 5
unruly = 3

noisemaker.util

noisemaker.util.load(filename)[source]

Load a .png or .jpg by filename.

Parameters:filename (str) –
Returns:Tensor
noisemaker.util.save(tensor, name='noise.png')[source]

Save an image Tensor to a file.

Parameters:
  • tensor (Tensor) – Image tensor
  • name (str) – Filename, ending with .png or .jpg
Returns:

None