What is Depix?

Depix is a tool that can recover plaintext from pixelized screenshots. It works by using a technique called linear box filtering to process every block of the pixelized image separately.


The algorithm uses the fact that the linear box filter processes every block separately. For every block it pixelizes all blocks in the search image to check for direct matches.

For some pixelized images Depix manages to find single-match results. It assumes these are correct. The matches of surrounding multi-match blocks are then compared to be geometrically at the same distance as in the pixelized image. Matches are also treated as correct. This process is repeated a couple of times.

After correct blocks have no more geometrical matches, it will output all correct blocks directly. For multi-match blocks, it outputs the average of all matches.

Known limitations

  • The algorithm matches by integer block-boundaries. As a result, it has the underlying assumption that for all characters rendered (both in the de Brujin sequence and the pixelated image), the text positioning is done at pixel level. However, some modern text rasterizers position text at sub-pixel accuracies.
  • You need to know the font specifications and in some cases the screen settings with which the screenshot was taken. However, if there is enough plaintext in the original image you might be able to use the original as a search image.
  • This approach doesn’t work if additional image compression is performed, because it messes up the colors of a block.


  • Install the dependencies
  • Run Depix:
python3 depix.py \
    -p /path/to/your/input/image.png \
    -s images/searchimages/debruinseq_notepad_Windows10_closeAndSpaced.png \
    -o /path/to/your/output.png

Example usage

  • Depixelize example image created with Notepad and pixelized with Greenshot. Greenshot averages by averaging the gamma-encoded 0-255 values, which is Depix’s default mode.
python3 depix.py \
    -p images/testimages/testimage3_pixels.png \
    -s images/searchimages/debruinseq_notepad_Windows10_closeAndSpaced.png

Result: image

  • Depixelize example image created with Sublime and pixelized with Gimp, where averaging is done in linear sRGB. The backgroundcolor option filters out the background color of the editor.
python3 depix.py \
    -p images/testimages/sublime_screenshot_pixels_gimp.png \
    -s images/searchimages/debruin_sublime_Linux_small.png \
    --backgroundcolor 40,41,35 \
    --averagetype linear

Result: image

  • (Optional) You can view if the box detector thingie finds your pixels with tool_show_boxes.py. Consider a smaller batch of pixels if this looks all mangled. Example of good looking boxes:
python3 tool_show_boxes.py \ 
    -p images/testimages/testimage3_pixels.png \
    -s images/searchimages/debruinseq_notepad_Windows10_closeAndSpaced.png
  • (Optional) You can create pixelized image by using tool_gen_pixelated.py.
python3 tool_gen_pixelated.py -i /path/to/image.png -o pixed_output.png
  • For a detailed explanation, please try to run $ python3 depix.py -h and tool_gen_pixelated.py.