A method (200) and apparatus (100) for compressing an image is disclosed.
The image is provided as one or more runs of pixels on a scanline basis.
The runs of pixels represent one or more graphical objects forming the
image. For each scanline of the image, pixel difference values between
each adjacent pixels of at least one run of pixels of the scanline is
determined. The pixel difference values for the run of pixels are then
compared to predetermined difference values. One or more coded bytes are
determined for the run of pixels depending on the comparison, each of the
coded bytes representing a difference value between at least two adjacent
pixels of the run of pixels. The one or more coded bytes are then stored
as a compressed representation of the run of pixels corresponding to the
scanline of the image.