SELF-COUNTING PIXELS
This webpage can be used to generate black-and-white images that contain a chosen number of black pixels, with that number also displayed in the image.
You can select any font from the list or enter a name of a font installed on your system. Warning! Trying to generate large images on devices without enough RAM might result in your browser crashing. Input big numbers responsibly!
TEXT
NUMBER
TEXT
RELATIVE SIZE ESTIMATE
How it works
The program begins by drawing everything except the number. Next, it counts how many black pixels have been used and estimates what the font size of the number should be so that the total number of black pixels matches the target number. It then quickly finds the font size at which the total number of black pixels is just above the target. In the last step, it removes the extra black pixels, leaving an image with exactly the desired number of black pixels.