Back to resources
I often want to edit or enlarge images I find in books or on postcards for
things like wallpaper or coffee mug &tc. However most images in books
are heavily dithered and the usual methods for removing dithering suck badly.
undither (a newer version of Image) takes a
different approach to the problem. It calculates the image's power spectrum,
and write it out as a colour ppm file. Any dithering will generate (coloured)
bright spots in the power spectrum. You can edit the power spectrum in your
favourite graphics editor and draw over these bright spots in black. undither
will then use this edited power spectrum the original image removeing all the
energy in the image where you've drawn black on the power spectrum. undither
can also do quite a good job of finding these bright spots by itself (but
ony in colourful images). undither mmaps the images into core and
internally deals with the image in 1024x1024 tiles, so you can process
arbitary large images. undither requires the fftw library.
The examples below should make it more clear.
Here is a postcard of the Pergamon altar in Berlin, I've drawn a red square
arround Hecate's left hand, you'll see why shortly. Let's call this image
perg.ppm.
Here's that little red square blown up, you can see the dithering the
printer has used, on the right is the power spectrum
which undither has made.
[james@lamia pergamon]$ undither -i perg.ppm -p ps.ppm
Now you can either paint over the spots in the power spectrum yourself,
or ask undither to do it for you.
[james@lamia pergamon]$ undither -i perg.ppm -a 0.01 -p akill.ppm
[james@lamia pergamon]$ undither -i perg.ppm -k akill.ppm -o automatic.ppm
or better still do it all in one step
[james@lamia pergamon]$ undither -i perg.ppm -a 0.01 -o automatic.ppm
This does a pretty good job - see below - but it can't get the monochrome
spots.
With a little help from the gimp I've drawn over the four white spots in
akill.ppm and called it mkill.ppm, and then fed this into undther
[james@lamia pergamon]$ undither -i perg.ppm -k mkill.ppm -o manual.ppm
As you can see that's removed all of the dithering.
Here's another example done entirely manually, it's part of a large
japanese drawing
[james@lamia bell]$ undither -i bell.ppm -p freq.ppm
| |
Detail from bell.ppm | freq.ppm |
We load the image into our favourite paint program and draw over the bright
spots and lines, then run it through undither
[james@lamia bell]$ undither -i bell.ppm -k filt.ppm -o out.ppm
| |
filt.ppm | detail from out.ppm |
Applying this filter gives us an almost perfect reconstruction of the image.
Take me to the files