1. A method for encoding image data, the image data being structured in blocks, the method comprising for each block in at least a portion of the image the steps of predicting the pixels of two edges of a block in a first prediction step, wherein the prediction is based on pixels of neighbouring blocks from the original image, and wherein estimated predictor pixels are obtained: determining residual data for the estimated predictor pixels; performing quantization and inverse quantization on the determined residual data for the estimated predictor pixels, wherein reconstructed residual data for estimated predictor pixels are obtained; reconstructing predictor pixels, wherein the difference between original pixels and reconstructed residual data for estimated predictor pixels is obtained; in a second prediction step, predicting remaining pixels of the block from the predicted predictor pixels of at least neighbouring blocks; determining residual data for each predicted pixel resulting from the first or second prediction step, the residual data being the difference between the predicted pixel and its corresponding original pixel; and entropy encoding the residual data.