Apparatus for encoding digital images, comprising - input means configured for acquiring at least a portion of an image (f) from a source, - output means configured for transmitting at least a portion of an encoded image to a destination, - processing means (1110, 1120, 1130, 1150, 1160) configured for o reading said portion of said image (f), o computing difference values between each pixel value of said portion of the image and each value of its adjacent pixels of the same portion, o determining quantized pixel difference values by quantizing said difference values on the basis of quantization information, o determining a weight map on the basis of said quantized pixel difference values, o computing an edge map (f') composed by elements (f' i) indicating whether a corresponding pixel of said portion of said image is an edge or not, wherein each of said elements is labelled as edge ("b") or non-edge ("w") on the basis of the values of said weight map associated to the image pixel corresponding to said element and to at least one image pixel adjacent to said image pixel corresponding to said element, o determining a reconstructed weight map (W') on the basis of each element (f' i) of the edge map (f') by assigning a higher or lower (m) value to the weight (w' ij) representing the similarity between two given pixels of the image on the basis of the number of said edges ("b") in the edge map (f') that are horizontal and/or vertical neighbours of the respective element (f' i), ∘ determining a graph transform matrix derived from said reconstructed weight map (W'), ∘ determining transform coefficients (f^) on the basis of said graph transform matrix and said portion of the image (f), ∘ transmitting, by means of the output means, said computed transform coefficients (f^) and said edge map (f') to said destination. - input means configured for acquiring at least a portion of an image (f) from a source, - output means configured for transmitting at least a portion of an encoded image to a destination, - processing means (1110, 1120, 1130, 1150, 1160) configured for o reading said portion of said image (f), o computing difference values between each pixel value of said portion of the image and each value of its adjacent pixels of the same portion, o determining quantized pixel difference values by quantizing said difference values on the basis of quantization information, o determining a weight map on the basis of said quantized pixel difference values, o computing an edge map (f') composed by elements (f' i) indicating whether a corresponding pixel of said portion of said image is an edge or not, wherein each of said elements is labelled as edge ("b") or non-edge ("w") on the basis of the values of said weight map associated to the image pixel corresponding to said element and to at least one image pixel adjacent to said image pixel corresponding to said element, o determining a reconstructed weight map (W') on the basis of each element (f' i) of the edge map (f') by assigning a higher or lower (m) value to the weight (w' ij) representing the similarity between two given pixels of the image on the basis of the number of said edges ("b") in the edge map (f') that are horizontal and/or vertical neighbours of the respective element (f' i), ∘ determining a graph transform matrix derived from said reconstructed weight map (W'), ∘ determining transform coefficients (f^) on the basis of said graph transform matrix and said portion of the image (f), ∘ transmitting, by means of the output means, said computed transform coefficients (f^) and said edge map (f') to said destination. o reading said portion of said image (f), o computing difference values between each pixel value of said portion of the image and each value of its adjacent pixels of the same portion, o determining quantized pixel difference values by quantizing said difference values on the basis of quantization information, o determining a weight map on the basis of said quantized pixel difference values, o computing an edge map (f') composed by elements (f' i) indicating whether a corresponding pixel of said portion of said image is an edge or not, wherein each of said elements is labelled as edge ("b") or non-edge ("w") on the basis of the values of said weight map associated to the image pixel corresponding to said element and to at least one image pixel adjacent to said image pixel corresponding to said element, o determining a reconstructed weight map (W') on the basis of each element (f' i) of the edge map (f') by assigning a higher or lower (m) value to the weight (w' ij) representing the similarity between two given pixels of the image on the basis of the number of said edges ("b") in the edge map (f') that are horizontal and/or vertical neighbours of the respective element (f' i), ∘ determining a graph transform matrix derived from said reconstructed weight map (W'), ∘ determining transform coefficients (f^) on the basis of said graph transform matrix and said portion of the image (f), ∘ transmitting, by means of the output means, said computed transform coefficients (f^) and said edge map (f') to said destination.