The invention relates to a method for encoding a digital image, in which method
the digital image is divided into blocks (C, L, U, UL, UR). In the method a spatial
prediction for a block (C) is performed to reduce the amount of information to
be transmitted, wherein at least one prediction method (P1-P13) is defined. In
the method a classification is determined for at least one neighbouring block (L,
U) of said block (C) to be predicted according to the contents of said neighbouring
block (L, U), and a prediction method (P1-P13) is selected for the current block
(C) on the basis of at least one said classification.