||In this paper we show how the image structure can be better preserved at lossy compression, when compression artifact is reduced with perceptually adaptive filtering by means of anisotropic diffusion, performed on the image before coding. Adaptive filtering extracts and preserves the important visual information, and it will be discussed in the context of the non-linear scale-space theory. Among the proposed non-linear diffusion equation we shall identify the one that is adequate for preprocessing. The effect of linear and non-linear diffusions prior to Joint Photographic Experts Groups (JPEG) standard baseline compression is analyzed and compared. It is shown that the selection of the appropriate preprocessing parameters at a specified bit-rate greatly reduces the compression artifacts. The selection criteria were determined using a perceptual error metric based on a model of the human visual system (HVS). The proposed method preserves well the main structure of the decompressed image and it does not change the perceptible image quality of the decompressed image considering all the details, while removing most of the compression artifacts.