Bitmap to Binary Converter

Reads an uploaded image's pixels via canvas getImageData, thresholds each pixel's luminance to a single bit (0 or 1), and concatenates the results row-major into one continuous binary string. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-27

Overview

Introduction

Any image can be reduced to its simplest possible representation: one bit per pixel, dark or light, nothing else.

This tool performs that reduction directly on an uploaded image, reading its real pixel data and producing a single continuous binary string.

What Is Bitmap to Binary Converter?

A converter that reads an uploaded image's pixel data and reduces each pixel to a single binary digit based on a luminance threshold.

It's the inverse mapping of the Binary Values to Bitmap Converter: where that tool turns bits into pixels, this one turns pixels back into bits.

How Bitmap to Binary Converter Works

The uploaded image is drawn onto an off-screen canvas and its raw RGBA pixel data is read with `getImageData`, entirely in the browser.

For each pixel, a perceptual luminance value (0.299×R + 0.587×G + 0.114×B) is computed and compared against the chosen threshold; pixels darker than the threshold become "1", others become "0", and all pixel bits are concatenated in row-major order with no separators.

When To Use Bitmap to Binary Converter

Use it to extract a simple black-and-white bit pattern from any photo, drawing, or scanned image.

It's also useful for experimenting with round trips through the Binary Values to Bitmap Converter, or for teaching how images reduce to raw bits.

Often used alongside Binary Values to Bitmap Converter.

Features

Advantages

  • Works with any image format the browser can decode (PNG, JPEG, GIF, WebP, and more), not just BMP.
  • Adjustable threshold lets you tune how much of the image counts as "dark" versus "light".
  • Everything happens client-side; the uploaded image never leaves your browser.

Limitations

  • Lossy by design: each pixel is reduced to a single bit, discarding all color and most brightness detail — the original image cannot be reconstructed from the output.
  • Capped at 500,000 total pixels to keep the browser responsive; very large images should be downscaled before uploading.

Examples

A high-contrast 2-pixel image

Input

A 2×1 image: pixel 1 = pure black (0,0,0), pixel 2 = pure white (255,255,255)

Output

10

Pure black has luminance 0, below the default threshold of 128, so it becomes "1"; pure white has luminance 255, above the threshold, so it becomes "0".

A mid-gray pixel at the default threshold

Input

A 1×1 image: pixel = mid-gray (128,128,128), threshold 128

Output

0

Mid-gray's luminance is exactly 128, which is not strictly less than the threshold of 128, so it's classified as "0" (light) rather than "1".

Best Practices & Notes

Best Practices

  • Increase contrast or convert to grayscale in an image editor first if your source image has subtle tonal differences that the default threshold flattens out.
  • Try a few different threshold values on the same image to see how the resulting bit pattern shifts.

Developer Notes

Uses `createImageBitmap` and an off-screen `<canvas>` with `getImageData` to read raw RGBA pixel bytes client-side, then applies the standard luma-weighted luminance formula per pixel before thresholding — no image library or server round trip is involved.

Bitmap to Binary Converter Use Cases

  • Extracting a simple 1-bit representation from a photo or drawing for further binary processing
  • Exploring round trips through the Binary Values to Bitmap Converter
  • Teaching how continuous-tone images reduce to raw binary data

Common Mistakes

  • Expecting the output to preserve color or grayscale detail — every pixel becomes strictly 0 or 1, nothing in between.
  • Uploading a very high-resolution image and being surprised by the pixel-count limit — downscale first for large photos.

Tips

  • Use a small, simple image (like a logo or icon) first to get an intuitive feel for how the threshold affects the output.
  • Lower the threshold to capture only the darkest regions as "1"; raise it to capture more mid-tones as "1" too.

References

Frequently Asked Questions