This paper proposes an image compression algorithm based on Swin Transformer and residual network (STRN), aiming to reduce blurring and distortions in traditionally compressed images. The algorithm utilizes a dual-channel mechanism to remove artifacts from the image, which takes advantage of the complementary features of the transform and residual networks. The Swin Transformer networks address the issue of long-range dependency, leading to an enhanced and improved reconstructed image quality. The residual network is an effective network that mitigates gradient loss and recovers image details during the image compression process. The paper demonstrates that image compression can be achieved by training a convolutional network based on a transformer and residuals network, which significantly reduces artifacts and provides better reconstructed image quality compared to previously used and current mainstream methods based on traditional convolutional neural networks. The proposed approach can remove blocking artifacts by subtracting estimated artifacts from the input image, while still preserving most of the original details. Therefore, our proposed method is highly effective in improving image quality and reducing visual artifacts caused by traditional compression methods. Moreover, this method is useful for enhancing image transmission and storage efficiency in various computer vision systems that employ digital visual codecs.