Image hash fixes

This pull request builds on the previous three. It refactors the ImageNode hashing for improved performance and clarity, and fixes a critical hashing bug which meant that viewing a Display node with the newer viewer processes gave the wrong result. I found a number of other hashing bugs along the way, so took the opportunity to fix those too, and then the final 2 commits are just miscellaneous tidy-ups I felt compelled to do.

This is the pull request you should use if you want to do any interactive testing of the new features. If you're happy with the content of all the requests after review, then it's sufficient just to merge this one and close the others - if not we can decide on the best course of action depending on how big the required changes are.

Only the final 8 commits are unique to this pull request.