Tool to convert an image into numbers 0,1,2,3,…,8,9 or even 255 from a grayscale palette to digitize the image.
Image in Numbers - dCode
Tag(s) : Image Processing
dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!
In computer science, a digital image is a discrete representation of a visual scene in the form of a matrix of numbers. Each element of this matrix corresponds to a pixel.
Mathematically, a grayscale image can be modeled by a matrix $ [M_{i,j}] $ where $ i $ and $ j $ denote the position of the pixel, and where the value $ M(i,j) $ represents its brightness.
The precision depends on the bit depth: with 8 bits, each pixel can take $ 2^8 = 256 $ values (from 0 to 255), while with 1 bit, each pixel can only take 2 values (black or white).
If the values are limited to a small set of integers (for example, from 0 to 9), the matrix can visually resemble ASCII art: the numbers become a simplified representation of the image.
Upload the image, indicate the number of digits, and click on convert.
Encoding an image digitally involves transforming each pixel into a numerical value representing its intensity.
In the case of a color image, each pixel has three components: Red (R), Green (G), and Blue (B). To obtain a grayscale value, the intensity is generally calculated using a weighted combination: $ L = 0.299R + 0.587G + 0.114B $ (this formula reflects the human eye's sensitivity to different colors).
Example: Bowl
000011111222222111110000
000111122222222221111000
001111222222222222111100
011112222233332222211110
011122223333333322221110
011122233333333332221110
111222233344443332222111
111222333444444333222111
111222333444444333222111
111222333444444333222111
111222333444444333222111
111222233344443332222111
011122233333333332221110
011122223333333322221110
011112222233332222211110
001111222222222222111100
000111122222222221111000
000011111222222111110000
Transforming numbers into an image involves performing the inverse operation: associating each number with a grayscale level.
If the numbers range from 0 to $ N-1 $, a linear correspondence can be defined: $ f(n) = \frac{255}{N-1} \times n $
Thus: $ 0 $ corresponds to black and $ N-1 $ to white; intermediate values produce proportional grayscale levels.
Each number is placed in its corresponding position in the matrix and then converted into a pixel.
If the image's width and height are unknown, line breaks can be used to determine the vertical dimension. Without this information, at least one of the two dimensions must be known to correctly reconstruct the image/picture.
Reducing the number of levels is equivalent to combining several real intensities into a single discrete value.
This operation introduces an error called quantization error.
The smaller $ N $ is, the greater the loss of information, which can cause visible effects such as posterization: the appearance of uniform areas instead of gradual gradients.
dCode retains ownership of the "Image in Numbers" source code. Any algorithm for the "Image in Numbers" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Image in Numbers" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "Image in Numbers" or any other element are not public (except explicit open source licence). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.
The content of the page "Image in Numbers" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source (Creative Commons CC-BY free distribution license).
Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).
To cite dCode.fr on another website, use the link:
In a scientific article or book, the recommended bibliographic citation is: Image in Numbers on dCode.fr [online website], retrieved on 2026-04-06,