Fixes for uint32 images

Several semi-related items to fix handling of uint32 images. These don't come up often, though an example would be OpenEXR with uint32 pixels representing object IDs.

The big offenders tended to be places where we used (signed) int values for quantization constants, which just didn't have enough range to properly hold a UINTMAX. Changing a bunch of those places to 'long long' does the trick.

You may be right. I may have made this change before some of the others that were sufficient. I'll double check and remove if it doesn't seem to make a difference.