A method of compressing image data that comprise a plurality of pixel values which are associated with a respective pixel, wherein the pixel values are compressed for at least some pixels according to the following steps: - determining an estimated pixel value of the respective pixel in dependence on the pixel value of at least one predetermined other pixel while using at least one estimation rule; - forming a difference value (24, 24') of the respective pixel that corresponds to a predetermined relation between the pixel value and the estimated pixel value of the respective pixel, with the difference value (24, 24') being represented by a first binary word (12, 12') which has a first length, with the first length being an effective length of the first binary word (12, 12'), characterized by: - encoding the first binary word (12, 12') by at least one second binary word (14, 14'), with the at least one second binary word (14, 14') having a second length that is a predetermined length of the respective second binary word (14, 14'), wherein the first length is compared with the second length to determine whether the first length is smaller than the second length; wherein the first binary word (12, 12') is completely encoded by a single second binary word when the first length is smaller than the second length; and wherein the first binary word (12, 12') is otherwise completely encoded by a plurality of second binary words, wherein the second length is the same for a respective pixel group, wherein the respective pixel group represents a local image region in the image data, and wherein the second length is selected as proportional to the average first length of the first binary words of the respective pixel group. - determining an estimated pixel value of the respective pixel in dependence on the pixel value of at least one predetermined other pixel while using at least one estimation rule; - forming a difference value (24, 24') of the respective pixel that corresponds to a predetermined relation between the pixel value and the estimated pixel value of the respective pixel, with the difference value (24, 24') being represented by a first binary word (12, 12') which has a first length, with the first length being an effective length of the first binary word (12, 12'), - encoding the first binary word (12, 12') by at least one second binary word (14, 14'), with the at least one second binary word (14, 14') having a second length that is a predetermined length of the respective second binary word (14, 14'), wherein the first length is compared with the second length to determine whether the first length is smaller than the second length; wherein the first binary word (12, 12') is completely encoded by a single second binary word when the first length is smaller than the second length; and wherein the first binary word (12, 12') is otherwise completely encoded by a plurality of second binary words, wherein the second length is the same for a respective pixel group, wherein the respective pixel group represents a local image region in the image data, and wherein the second length is selected as proportional to the average first length of the first binary words of the respective pixel group.