Demoniac Demo maniac
Joined: 05 Dec 2010
|Posted: Wed Oct 04, 2017 10:45 am
Post subject: A method of removing JPEG artefacts from old screenshots
|JPEG compression has ruined many an old screenshot in the 90s, but there's a way to somewhat reduce the damage.
For example, here's a screenshot from Tyrian that comes from the Epic MegaGames website (magnified at 2x using nearest neighbour interpolation for better viewing):
There's quite noticeable tiling, overall blurriness and distortions around the edges known as mosquito noise. I've been trying to figure out a way to reduce these kinds of artefacts, and came up with the following method using GIMP. The result is shown below:
The much cleaner image is accomplished by the following steps:
1. Import the source image into GIMP. Personally I prefer to first convert it from JPEG to a lossless format prior to importing but I think it doesn't actually make any difference.
2. Scale the image to 400% of its original size (which is 1280x800 in the case of a 320x200 image) setting interpolation to None (other software may call this the nearest neighbour interpolation).
3. Apply Median filter at the redius of 2. To do this, go Filters -> Enhance - > Despeckle, in the dialog box uncheck Adaptive and Recursive (if checked), set Radius to 2, Black level to -1 and White level to 256. In Photoshop, just use the Median filter with the same radius. This will reduce some of the mosquito noise.
4. Apply selective Gaussian blur (Filters -> Blur -> Selective Gaussian Blur). The Radius and Threshold levels might need to be adjusted for each image individually to achieve adequate mosquito noise removal. For the image above, I used Radius 10 and Threshold 20.
5. Apply the Pixelise filter (Filters -> Blur -> Pixelise) with pixel width and height both set to 4. This will effectively revert the image to its state when it was scaled up from the original size at 400% with the nearest neighbour interpolation.
6. Apply the sharpen filter at a high level of sharpness. I used 50 in this example. This is optional but will help make the resulting image more crisp by offsetting the effects of the blur filter used above.
7. Scale the image down to its original size. The Sinc3 (Lanczos) interpolation method seems to produce good results here.
Note that wile this method reduces visible mosquito noise, it does not address other distortions resulting from JPEG compression, such as discolouration, colour distortion, blurring and loss of image detail due to the former. Also areas with low contrast between neighbouring pixels get more blurry due to the selective Gaussian blur filter, which may result in some loss of detail. However overall the image is cleaned from the noticeable JPEG compression artefacts while preserving much of original detail.