I've read a large number of books and papers on the science of color correction and concluded that most of it bollocks, it's one of those assume everything is linearly independant and then try and fit some random non linear function blah blah blah.... The correct way to do it is clearly to have a 256x256x256x3 lookup table which with modern machines it is now possible to do, it's also a lot quicker than doing a whole batch of calculations.

However it's quite hard to generate such a table. I took the simple solution I wrote a program which generates swatches of colours (5820 in all) which I sent to my printer... I then scanned them back in only to discover that most scanners (mine included) have an automatic gain control. So I redid my color swatches so that every row added up to a constant and but black and white stripes between each color cell. The result is as follows.

The original image The printed and scanned image

I then used a delojay tetraheadration [with the aditional datapoints that (r,g,b)->(r,g,b) for r,g,b in {0,1}] to construct a function to map between the two spaces, then using that caclulated the lookup tables this is done for each component for both a forwards and a backwards transform. Once this is done it's possible to use a simple comand line tool to preform these transformations quickly.

The scanned image, back transformed The original image, forward transformed

Note that there are some colors that the printer can't display they're mostly greens. Anyway it works very well for photographs and it's very quick since there are no complex logarythms to calculate.

Take me to the files

Here are some more examples
note how there are some colours my printer just can't manage, and also how the colour correction brings out some bad JPEG artifacts. There are some moiré fringes as I scanned that at 600 dpi and this is almost exactly the same as the resolution that my printer uses when it does continous tone [which it does by drawing vertical lines whose width is continously variable]
1.jpg1.jpg thru colcor -b printed and scaned
1.jpg thru colcor -f1.jpg printed and scaned

2.jpg2.jpg thru colcor -b printed and scaned
2.jpg thru colcor -f2.jpg printed and scaned

3.jpg3.jpg thru colcor -b printed and scaned
3.jpg thru colcor -f3.jpg printed and scaned

4.jpg4.jpg thru colcor -b printed and scaned
4.jpg thru colcor -f4.jpg printed and scaned

5.jpg5.jpg thru colcor -b printed and scaned
5.jpg thru colcor -f5.jpg printed and scaned