Rewrite all save functions to take a pdImage object as a parameter

Previously, they just took the ordinal of an image in the central
pdImages() array.  This worked fine for normal saving, but not for
things like exporting a histogram image - because it required non-main
images to be placed into the master array, which never made much sense.

This also simplified a lot of the save code.
Miscellaneous batch wizard bugfixes