Skip to content

Generate Random Bitmap

Create a random-pixel image up to 1024 × 1024 in black and white, grayscale, full colour or your own palette. Set the black-pixel density, use a seed for a repeatable image, and download a crisp PNG or a real 24-bit .bmp file at up to 32× scale.

Pixels from crypto.getRandomValues(), or a seeded generator

Pixels
4,096
Download size
256 × 256
PNG at 1×
…
BMP at this scale
192.1 KB

White Noise: Every Pixel on Its Own

Each pixel here is drawn independently of its neighbours, which makes the image white noise: the snow on an untuned analogue TV, or the grain test pattern used to check a display or an image pipeline. There are no shapes, gradients or edges on purpose; any clusters you see are chance.

That is different from the "noise" used for clouds, terrain and marble textures. Perlin, simplex and value noise blend random values smoothly across space, so neighbouring pixels are similar. If you want soft, organic texture, white noise is the wrong starting point; blurring it helps only a little.

In black-and-white mode, Black pixels (%) sets the density. At 50% you get static; at 5 to 10% you get scattered dots, the "salt and pepper" pattern used to test denoising filters. In My colours mode each colour is equally likely, so add a colour twice to make it twice as common.

Worked Example: 512 × 512 Noise That Won’t Compress

A developer needs a worst-case image to test an upload limit. A 512 × 512 photo is usually well under 100 KB as a JPEG, but a full-colour noise image of the same size can't be squeezed: every pixel carries 24 bits that nothing else predicts.

Step 1: Raw pixel data

512 × 512 pixels × 3 bytes = 786,432 bytes

Step 2: As a 24-bit BMP

786,432 + 54-byte header = 786,486 bytes (768 KB)

Step 3: As a PNG

About the same or slightly larger: compression finds nothing to remove

Random pixels are the largest an image of that size can be. The minimum depends only on how much randomness each pixel holds, so the colour mode decides it:

Minimum lossless size of a 512 by 512 random image by colour mode
Colour modeRandom bits per pixelSmallest possible file data
Black and white, 50%132,768 bytes (32 KB)
My colours, 4 colours265,536 bytes (64 KB)
Grayscale8262,144 bytes (256 KB)
Full colour24786,432 bytes (768 KB)

Browsers save canvas PNGs as full colour even when the image only has two colours, so the PNG of a black-and-white noise image is larger than this minimum. The PNG at 1× tile above shows the real size of the file your browser makes. The same 512 × 512 canvas filled with a single colour compresses to a few kilobytes.

PNG or BMP: Which Download?

"Bitmap" usually just means an image made of pixels, so for websites, documents and image editors, take the PNG. It is lossless, works everywhere and is never larger than it needs to be.

Take the BMP when something specifically asks for a .bmp file: older Windows software, some embedded displays and microcontroller libraries, or your own code, where an uncompressed format with a fixed header is easy to read byte by byte. Its size is predictable from the dimensions alone, as the tile above shows.

Avoid JPEG for noise. Lossy compression smears random pixels into blocks and ringing, and still produces a large file, so you lose the noise and gain nothing.

Inside the 24-bit BMP File

The BMP download is a 14-byte file header, a 40-byte BITMAPINFOHEADER, then the pixels. All numbers are little-endian.

Fields in the BMP header written by this page
Byte offsetFieldValue written
0Signature"BM"
2File size in bytes54 + row size × height
10Offset to pixel data54
14Info header size40
18 / 22Width / heightPixels; positive height = bottom-up
28Bits per pixel24
30Compression0 (BI_RGB, none)
38 / 42Resolution2,835 px/m (72 dpi)

Two details trip up people who write their own BMP reader. Rows are stored bottom to top, and each pixel is stored as blue, green, red. And every row is padded to a multiple of 4 bytes: a 5-pixel-wide row holds 15 bytes of colour, so one zero byte is added to make 16. Widths that are a multiple of 4 need no padding.

Repeatable Noise With a Seed

Leave Seed empty and every image is new, drawn from your browser's secure random source. Type any text, such as test-001, and the page switches to a seeded generator (sfc32): the same seed, size and colour settings always produce exactly the same pixels, on any device.

That is useful when an image is a test fixture. You can regenerate the identical input for a resize or compression test instead of storing the file, compare a filter's output before and after a code change, or tell a colleague "seed test-001, 256 × 256, grayscale" instead of sending an attachment. Changing the size changes the image, because the pixels are read from the sequence row by row.

Seeded output is predictable by design, so don't use it where unpredictability matters. The seed is only used in your browser and is not part of the downloaded file.

Enlarging Pixels Without Blur

A 16 × 16 image is tiny on screen. Enlarging it with ordinary smooth resizing blends neighbouring pixels into a blur. To keep hard square edges, enlarge by a whole number using nearest-neighbour scaling, which is what Download scale does: 16 × 16 at 16× gives a 256 × 256 file where each original pixel is a 16 × 16 block.

  • CSS: image-rendering: pixelated; on the img keeps a small image sharp when the browser scales it up.
  • Photoshop: Image Size, resample with Nearest Neighbor (hard edges).
  • GIMP: Scale Image with Interpolation set to None.

Whole-number scales matter. At 1.5× some pixels become two pixels wide and others one, which makes the grid look uneven.

Frequently asked questions

Is a random bitmap the same as a BMP file?

Not necessarily. Bitmap means any image stored as a grid of pixels. This page offers both a PNG and a true 24-bit .bmp file of the same pixels.

Will the noise tile seamlessly as a background?

Yes. Because every pixel is independent, there is no edge pattern to break, so copies placed side by side join without a visible seam. On a very large area the repeat of the whole tile can become noticeable.

Can I make a transparent noise image?

No, every pixel is fully opaque. Make the noise here, then lower its layer opacity or use a blend mode such as Overlay in an image editor to lay it over another picture as grain.

Why is the PNG of my black-and-white image so large?

Browsers save canvas images as full-colour PNGs, and random pixels compress poorly. Use the BMP if you need a predictable size, or convert to a 1-bit PNG in an image editor.

Sources