In this paper, we shall propose a new method that modifies the AC coefficients of the image blocks suffering from blocking effects so as to improve the image quality. The AC coefficients are modified in accordance with the information provided by the neighboring blocks. Our new method employs an artificial neural network to help make clear the relationships between the AC coefficients of the current block and those of its neighboring blocks, so that we can accordingly determine whether or not to modify the current AC coefficients and what value the AC coefficients should be changed to. Then, after reversing the modified values from the DCT frequency domain to the pixel domain, we can successfully eliminate blocking effects. As our experimental results will show, our new method is capable of giving high quality images.