1. A method of encoding an image comprising: creating a prediction block of a current block by performing one of intra prediction and inter prediction on the current block; determining n filters from a natural image based on a predetermined model; filtering the prediction block and pixels adjacent to the prediction block and included in a previously encoded region which is adjacent to the current block, to remove blocking artifacts from the prediction block, with the n filters, to obtain a filtered prediction block; and encoding the current block based on the filtered prediction block, wherein the natural image is comprised of a number of patterns, the number of n filters corresponds to the number of patterns in the natural image, and the filtering comprises repeatedly filtering the prediction block and the adjacent pixels with the n filters.