A method and system of compressing digital image data organized as successive data groups of bits, the contents of which are values of pixels of an image, by checking a first condition of whether a first data group has the same contents as one or more following data groups. If the first condition is satisfied, then the data groups are replaced, in a compression step, by a compression code representing these data groups. Otherwise, in a copying step, only the first data group is replaced by a cod...