My web page documenting my experiences converting a giant book from mobi to ebub has a couple of script people might find useful (or even want to steal and incorporate into calibre). The web page is here:
Search for jpg-to-png to find the script that replaces opaque grayscale jpg files with black png images with different transparency levels so nice non-white backgrounds show through and the images look more natural in an ebook reader where you have set a non-white background. (Warning: Don't run this too early in the conversion process or something in calibre removes the transparency and you are left with just black boxes - I typically just use tweak book to run it last after everything else). This is a bit of a frankenstein monster that uses gimp and perl and imagemagic, but it gets the job done.
Another script I found useful to run in the DEBUG/input directory to tweak a conversion early was markup-from-toc which embeds the contents of the toc.ncx file into the html as markup with class=chapter attributes so you can tell the converter to look for those and rebuild the proper toc (assuming the .ncx file is correct to start with).