to_pil - don't rescale if int and in range 0-255
# What does this PR do?

#21969 Introduced a bug where binary masks would have their values rescaled to between 0-255. 

This was because of [this part](https://github.com/huggingface/transformers/blob/4063fd9cba6b72ebfd5c663a307ab9d5ff1a153d/src/transformers/image_transforms.py#L161) of the logic check. The original assumption was that inputs with their values between 0-1 would be rescaled images with float pixels. However, binary masks aren't and shouldn't be rescaled. 

We now check first if the input is of type uint8. Then check if any precision is lost when converting to int and that the int values are in the valid range 0-255 and finally if float values are between 0-1. 


Fixes #22147


## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#start-contributing-pull-requests),
      Pull Request section?
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [x] Did you write any new necessary tests?

_The documentation is not available anymore as the PR was closed or merged._