Algosim documentation: DissolveToColorStochastically


Returns a pixmap with each pixel unchanged or set to a given colour with a given probability.



DissolveToColorStochastically(pm, c, p) returns pm with each pixel either unaltered or set to c with the probability of the latter being p. If omitted, p defaults to 0.5.

The overload with a function instead of a colour will use f(x, y) as the colour at pixel (x, y).


DissolveToColorStochastically(ExampleData("rabbit"), (x, y) ↦ hsv(x + y, 1, 1), 0.25)

Image 1

See also