Removing JPEG artifacts with GIMP
assembly date
2008, October 31.
author(s)
Balla Marcell
keywords
- image processing
- GIMP
This article should help linux users (members of the free software community) to improve images that suffer from compression artifacts like blockiness and unnatural edges.
An example how such an image could be produced is a cell phone camera with low resolution. Another example would be an image saved with a high compression (thus low quality) level by a greenhorn computer user. More and more users are using the internet and uploading photos to it. Unexperienced people tend to always make use of the JPEG file type. Whilst it is designed to save photorealistic images with reasonable file sizes by applying lossy compression, it shouldn't be used for images that contain many sharp edges (like text).
But what if the source image you get is a low quality, blocky, ugly JPEG? In this case you will probably think about cleaning up the picture. But how? There are many free or commercial software products available under Windows (even Photoshop plug-ins) that deal with this exact situation. However I haven't found any linux application or even GIMP plug-in that would do the job for me.
Here is an easy step-by-step guide how you can manually clean up blocky JPEG images. You will not be able to get a perfect result but the outcome should look much better than the source picture.
Please note that values used in the following example are NOT universal. They vary depending on the quality of the input. So you are welcome to experiment a little bit to achieve the result you like best. The steps however should be performed in the same order as they are presented.
Step 1: Open the image with GIMP and resize it to twice the size of the original. You can do this by selecting "Image / Scale Image..." from the menu. In the appearing dialog set the image size units from "pixels" to "percent" and change the width/height to the value "200".
Step 2: Open the noise generator by selecting "Filters / Noise / HSV Noise..." from the menu (see Figure 1). Set a small value for "Holdness" and "Hue" to produce distinct noise with appropriate color values. "Saturation" and "Value" should also be set rather low to avoid intense color differences between the noise and the original image. Enable the preview function to help you adjust the filter settings. If the noise seems to neatly overlap the blockiness, click "OK".
Figure 1: HSV noise filter with exemplary values
Step 3: Resize the image to its original size by opening the same dialog as in Step 1 and applying a "percent" value of "50".
Step 4: Now you should smoothen the result by using a blur filter. Choose "Filters / Blur / Selective Gaussian Blur..." from the menu (see Figure 2). Use a small "Blur radius" and "Max. delta" value to get an effective and nice looking result.
Figure 2: Selective gaussian blur filter with exemplary values
That's all there is to it! Comparing the input and output you should see an improvement by the lacking of blocky compression artifacts. Check out the images in Figure 3 below to get an impression of the targeted quality enhancement.
Figure 3: Comparison of a zoomed part of the original and filtered image
The noise from Step 2 shouldn't fall into account because of the convolution performed by the bluring filter. However because of the bluring filter of Step 4 the image loses some of the details lying in the sharpness. Feel free to experiment with the filters introduced above.
You are also welcome to compare the full size original image with the filtered one: original image / filtered image.

GIMP website