1. A computer-implemented method for reducing a number of bits representing pixels in an electronic image, the method comprising: obtaining an electronic image comprising a plurality of N-bit pixel values; generating, for each of the plurality of N-bit pixel values, an M-bit pixel value, wherein M<N, wherein the generating comprises: determining a least significant bit part as a remainder of dividing the N-bit pixel value by a base; determining a most significant bit part as an integer part of a quantity obtained by dividing the N-bit pixel value by the base; applying binary error diffusion to the least significant bit part, whereby an output bit is obtained; providing an M-bit pixel value as a capped sum of the most significant bit part and the output bit; and providing an output image comprising a plurality of M-bit pixel values obtained from the generating.