I have a 256 gray levels image, which I want to draw thanks to only #000 (black) and #FFF (white) pixels (nothing else).
One way to do that is to use dithering : https://upload.wikimedia.org/wikipedia/commons/6/6d/Dithering_example_red_blue.png
In such an algorithm, a sort of blur is made by increasing the number of pixels (white and black for me) in an area.
I don't know how to implement it however : how can I determine the number of pixels to represent the required level of gray ? Could you please write such an algorithm (use pseudocode for example, or Java, Scala, C, C++) ?