1. A method of compressing an image formed of pixels, comprising: (a) providing a pixel of the image, to be encoded; (b) selecting at least two pixels of the image, other than the encoded pixel, defining a straight line including the encoded pixel, to serve as prediction pixels; (c) calculating a prediction value for the encoded pixel using at least the selected pixels; (d) determining a difference between the calculated prediction value and the actual value of the encoded pixel; (e) encoding the determined difference, such that the encoding error is bounded; and (f) repeating (a)-(e) for at least 5% of the pixels of the image.