Fixed problem when outputting images that have a minimum value greater than 0 which was causing loss of data.