1. An image processing device, comprising: a processor; and a computer readable memory, wherein the computer readable memory contains one or more programming instructions for performing a method for processing an input image to form an output image, wherein the input image includes a plurality of input pixels, wherein each input pixel includes an input pixel intensity value having a first number of possible levels representing a lightness of a pixel, wherein the output image includes a plurality of output pixels, wherein each output pixel includes an output pixel intensity value having a second number of possible levels, the method comprising: receiving an input pixel intensity value for an input pixel, determining a modified input pixel intensity value based on information pertaining to one or more second pixels, determining a threshold value based on at least the input pixel intensity value and a stored pixel value corresponding to the input pixel, wherein the stored pixel value is stored in a scanline buffer memory, determining an output pixel intensity value by comparing the modified input pixel intensity value with the threshold value, setting the stored pixel value corresponding to the input pixel to a first value, setting a decremented pixel value to the stored pixel value corresponding to the input pixel, selecting a previously unselected pixel, decrementing the decremented pixel value by a second value, retrieving a stored pixel value corresponding to the selected pixel, setting the stored pixel value corresponding to the selected pixel to the decremented pixel value in response to the decremented pixel value being greater than the stored pixel value corresponding to the selected pixel, and repeating the selecting, decrementing, retrieving and setting the stored pixel value corresponding to the selected pixel while the decremented pixel value is greater than both zero and the stored pixel value corresponding to the selected pixel.