Revert "fix cast from double to unsigned to round predictably"

This reverts commit 07bc0c865e1d60eed74825deff035fef2ade15da.
second try (this one without accidentally deleting test images):fix cast from double to unsigned to round predictably