1. A method for compressing a digital image, comprising the steps of: selecting an image patch of the digital image; assigning the selected image to a specific class (z), using a classifier; transforming the image patch with a class-specific transformation function; quantizing the transformed image patch, wherein parameters of the classifier have been learned from a set of training image patches.