Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have a number of line-art charts unfortunately saved as JPEGs. They are now riddled with distracting compression artifacts or "speckles". Is there any way of removing these? I do not have the original files and it will be very difficult to recreate them.

I am running Windows 7 and tried Paint.Net; none of the filters help. Posterize washed out all the colors and leaves the speckles. Blur makes text unreadable. Noise Reduction wrecks antialiasing of curved lines, and perversely enhances the speckles, making them look like checkerboards.

Yes, I have Googled for software to do this; there are many programs that advertise despeckling but, after my experience with Paint.Net, do not want to experiment with applications that show no before and after images. The only example I have seen that does what I want is from a Photoshop tutorial. I have dozens of files and the tutorial requires considerable manual fine-tuning. I would prefer to automate or batch-process this task. Commercial apps are fine, but I do not want to spend over $600 and learning a complex program for a single task.

share|improve this question
Just wondering, do you have experience in image editing or photography in any way? – digitxp Jan 5 '11 at 2:49
@digitxp, "in any way"? yes. An expert? Not even close. – Dour High Arch Jan 6 '11 at 1:09
Whoops, hehe, the comment should have said "much"... – digitxp Jan 6 '11 at 5:10
up vote 4 down vote accepted

The GIMP has a despeckle filter.

share|improve this answer
I've also made good experience with the "Selective Gaussian Blur" filter. – Bobby Jan 2 '11 at 21:03
Ah, Selective Gaussian. Helped me a lot in some occasions. Just make sure your image was big enough to start with. – digitxp Jan 2 '11 at 21:10
I was afraid someone would suggest The GIMP; I tried it years ago and found it unusable. To humor you, I tried it again and it has improved enormously. Not only does its despeckle work fine, I could even use the Photoshop tutorial on it. – Dour High Arch Jan 5 '11 at 2:44
I like throwing around the fact that the founders of Google made the logo with it. Anyway, perhaps GIMPShop would help. – digitxp Jan 5 '11 at 2:48
@digitxp, to be clear, GIMP did work for me, and I was able to get despeckle to work by following the Photoshop tutorial. It did require manual fine-tuning, so it seems an automated solution is unlikely. – Dour High Arch Jan 6 '11 at 1:10

I don't think you'll be able to get a perfect despeckle filter without tweaking (e.g. how can a filter know whether an "i" is really a small "l" with a speckle on top?).

However: the convert command from ImageMagick is quite powerful for batch processing. You might find a filter that works well for your purposes. Most of the before/after images for ImageMagick are for photos rather than for line drawing, so I made some from an old childhood drawing:

Input File

Running convert in.jpg -despeckle despeckle.jpg gives

enter image description here

If you flick between the two images you notice that the despeckled image is significantly less noisy. The text is also a little softer.

There are other filters you can try like '-enhance'. Note that you aren't limited to the built in filters, there are scripts for imagemagick that provide more powerful filters, for example the Kuwahara script. (a simple version of Kuwahara is also built into the latest ImageMagick)

Running kuwahara in.jpg kuwahara.jpg gives:

enter image description here

Kuwahara can do a better job of de-speckling line art because it preserves edges, which is what line art is all about. In the case of this pen drawing it also makes it look a bit like it was drawn in felt tip.

Yet more powerful filters can be developed in python. See:

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .