RandomImage
✖
RandomImage
Details and Options

- RandomImage gives an image where pixel values are drawn from a specified distribution. The pixel values are not correlated spatially.
- Random images can be used for creating synthetic noise images and image effects.
- RandomImage by default gives an image of a real type.
- RandomImage[] is equivalent to RandomImage[1,{150,150}].
- RandomImage[…] is equivalent to RandomImage[…,{150,150}].
- The size specification can be one of the following:
-
side 2D image of size {side,side} {width,height} 2D image size specification {width,depth,height} 3D image size specification - Possible settings for "type" include:
-
"Bit" integer 0 or 1 "Byte" integer 0 through 255 "Bit16" integer 0 through 65535 "Real32" single-precision real (32 bit) "Real64" double-precision real (64 bit) - RandomImage accepts all Image and Image3D options with the following additions and modifications:
-
ColorSpace Automatic generates an image of the specified color space Interleaving None whether to generate an interleaved image
Examples
open allclose allBasic Examples (3)Summary of the most common use cases
Scope (8)Survey of the scope of standard use cases
Distribution (5)
By default, pixel values range from 0 to 1:

https://wolfram.com/xid/0i1p22ndu-qq84t5

Specify a range of pixel values:

https://wolfram.com/xid/0i1p22ndu-y656ju


https://wolfram.com/xid/0i1p22ndu-1k0qtq

Generate an image from pseudorandom values in the range 0 to :

https://wolfram.com/xid/0i1p22ndu-lqs39c


https://wolfram.com/xid/0i1p22ndu-s13kyr

A random image from a normal distribution:

https://wolfram.com/xid/0i1p22ndu-unj2qq


https://wolfram.com/xid/0i1p22ndu-4jn9ev

Generate a 4-channel image using some multivariate distribution:

https://wolfram.com/xid/0i1p22ndu-pzcgm


https://wolfram.com/xid/0i1p22ndu-cxawxe

Size (2)
By default, a 2D image is generated:

https://wolfram.com/xid/0i1p22ndu-nt8xzi

Specify the image dimensions for a square image:

https://wolfram.com/xid/0i1p22ndu-63fqi8


https://wolfram.com/xid/0i1p22ndu-lxbinz

Specify the 3D image dimensions:

https://wolfram.com/xid/0i1p22ndu-1sfbgw

Options (5)Common values & functionality for each option
ColorSpace (4)
By default, no explicit color space is assumed:

https://wolfram.com/xid/0i1p22ndu-teb3jj


https://wolfram.com/xid/0i1p22ndu-m4d40x


https://wolfram.com/xid/0i1p22ndu-2z2azi


https://wolfram.com/xid/0i1p22ndu-p5a3a5

Generate a random "RGB" image:

https://wolfram.com/xid/0i1p22ndu-yzct26

Generate an "HSB" image using some univariate distribution:

https://wolfram.com/xid/0i1p22ndu-gd9fqt

Generate a "LAB" image using a multivariate uniform distribution with specific bounds:

https://wolfram.com/xid/0i1p22ndu-oo4sqg

Applications (4)Sample problems that can be solved with this function

https://wolfram.com/xid/0i1p22ndu-cg49rn


https://wolfram.com/xid/0i1p22ndu-ble6vd


https://wolfram.com/xid/0i1p22ndu-ued5c7

RGB image simulating salt-and-pepper noise using a heavy-tail distribution:

https://wolfram.com/xid/0i1p22ndu-4ms7vd

Properties & Relations (7)Properties of the function, and connections to other functions
Generate an image with constant intensity:

https://wolfram.com/xid/0i1p22ndu-v2wuz3

Use the specialized function ConstantImage instead:

https://wolfram.com/xid/0i1p22ndu-2hywou

Generate the random data using RandomReal:

https://wolfram.com/xid/0i1p22ndu-onuxdy

Generate a random binary image using RandomInteger:

https://wolfram.com/xid/0i1p22ndu-2uxkg5

Generate the random data using RandomVariate:

https://wolfram.com/xid/0i1p22ndu-eqfh9w

In a uniformly random image, neighboring pixels are not correlated:

https://wolfram.com/xid/0i1p22ndu-o2uu6f


https://wolfram.com/xid/0i1p22ndu-kwojq7


https://wolfram.com/xid/0i1p22ndu-238eh5

After local filtering, pixel values drawn from the original distribution are spatially correlated:

https://wolfram.com/xid/0i1p22ndu-xo2c7h


https://wolfram.com/xid/0i1p22ndu-wgodbn

Create an image with pixels randomly chosen from a list of colors:

https://wolfram.com/xid/0i1p22ndu-smky85

Create an image from colors randomly chosen from a convex hull defined by a list of colors:

https://wolfram.com/xid/0i1p22ndu-wgkiry

Possible Issues (1)Common pitfalls and unexpected behavior
Out-of-range pixel values are rendered as black or white:

https://wolfram.com/xid/0i1p22ndu-7ok9fc

Use ImageAdjust to see the full range of values:

https://wolfram.com/xid/0i1p22ndu-3m9svd

Wolfram Research (2010), RandomImage, Wolfram Language function, https://reference.wolfram.com/language/ref/RandomImage.html (updated 2020).
Text
Wolfram Research (2010), RandomImage, Wolfram Language function, https://reference.wolfram.com/language/ref/RandomImage.html (updated 2020).
Wolfram Research (2010), RandomImage, Wolfram Language function, https://reference.wolfram.com/language/ref/RandomImage.html (updated 2020).
CMS
Wolfram Language. 2010. "RandomImage." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/RandomImage.html.
Wolfram Language. 2010. "RandomImage." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/RandomImage.html.
APA
Wolfram Language. (2010). RandomImage. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RandomImage.html
Wolfram Language. (2010). RandomImage. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RandomImage.html
BibTeX
@misc{reference.wolfram_2025_randomimage, author="Wolfram Research", title="{RandomImage}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/RandomImage.html}", note=[Accessed: 24-April-2025
]}
BibLaTeX
@online{reference.wolfram_2025_randomimage, organization={Wolfram Research}, title={RandomImage}, year={2020}, url={https://reference.wolfram.com/language/ref/RandomImage.html}, note=[Accessed: 24-April-2025
]}