Tool to transform images into black and white (grayscale). A grayscale image is an image whose colors vary from white to black.
Grayscale Image - 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!
Black and white is understood here as a grayscale gradient. For transforming an image into binary black or white (only black and white, no gray), indicate 2 shades of gray, and for the binary exploitation of the result, dCode has a tool for that:
Each color pixel in an image is typically defined by a triplet of red, green, and blue (RGB) values. But it is also possible to define it by a HSV triplet for hue (rather red, rather green, rather blue), saturation (rather bright color or rather grayish) and luminosity/value (rather light or rather dark). This brightness value is generally used to define the position / color of the pixel between black and white and thus obtain a grayscale image.
To calculate this luminosity, several algorithms / color referentials are possible, such as recommendations 709, 601 or 2100 used as a standard in photography or video (and from the CIE Commission Internationale de l'Éclairage).
dCode calculates the brightness value for each pixel in the image and returns a gray pixel of corresponding brightness.
If an error is returned, it may be an altered file, a bad image, or the file format does not match its extension.
Recommendation 709 is used as a standard for HDTV.
Recommendation 601 was used as a standard for analogic terrestrial television. Luminance is calculated as Gray = 0.299 * Red + 0.587 * Green + 0.114 * Blue
Example: A color representing the color Orange consisting of Red = 255, Green = 127, Blue = 0. Then the value of gray is 255*0.299+127*0.587+0*0.0114=151
dCode retains ownership of the "Grayscale Image" source code. Any algorithm for the "Grayscale Image" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Grayscale Image" 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 "Grayscale Image" or any other element are not public (except explicit open source licence like Creative Commons). 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 "Grayscale Image" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source.
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: Grayscale Image on dCode.fr [online website], retrieved on 2025-04-16,