CommunityToolkit / CommunityToolkit/Windows
About the issue of ImageCropper missing a pixel from a cropped image
- Dominant language
- C#
- Stars
- 1.1k
- Forks
- 166
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the bug
When I used ImageCropper to cut the image,
the computer resolution was about 2K, and the image size was 128x296.
If I select the button method to reduce the area and then select all the pictures for cutting and saving,
there will be a loss of one pixel,
the size of the picture will become 127x295,
this time it will affect the image when I convert the picture to a fixed resolution,
and then affect the display,
I have seen the source code, the source code part will lose some data when there is a rounding,
so I want you to see if there is any solution to solve this problem.

The compressed package is a test image.
[test_image.zip](https://github.com/user-attachments/files/19846559/test_image.zip)
### Steps to reproduce
```text
When I used ImageCropper to cut the image,
the computer resolution was about 2K, and the image size was 128x296.
If I select the button method to reduce the area and then select all the pictures for cutting and saving,
there will be a loss of one pixel,
the size of the picture will become 127x295,
this time it will affect the image when I convert the picture to a fixed resolution,
and then affect the display.
```
### Expected behavior
I want to cut the image if the length and width of the picture is 128:296, if I choose the original image size, please do not remove one pixel, this will affect the display of the image.
The picture below shows the picture of my device

### Screenshots
The picture below shows the operation diagram of cutting

The image below is a screenshot of the saved resolution after the cut

### Code Platform
- [ ] UWP
- [x] WinAppSDK / WinUI 3
- [ ] Web Assembly (WASM)
- [ ] Android
- [ ] iOS
- [ ] MacOS
- [ ] Linux / GTK
### Windows Build Number
- [ ] Windows 10 1809 (Build 17763)
- [ ] Windows 10 1903 (Build 18362)
- [ ] Windows 10 1909 (Build 18363)
- [ ] Windows 10 2004 (Build 19041)
- [ ] Windows 10 20H2 (Build 19042)
- [ ] Windows 10 21H1 (Build 19043)
- [ ] Windows 10 21H2 (Build 19044)
- [ ] Windows 10 22H2 (Build 19045)
- [ ] Windows 11 21H2 (Build 22000)
- [ ] Other (specify)
### Other Windows Build number
_No response_
### App minimum and target SDK version
- [ ] Windows 10, version 1809 (Build 17763)
- [ ] Windows 10, version 1903 (Build 18362)
- [ ] Windows 10, version 1909 (Build 18363)
- [ ] Windows 10, version 2004 (Build 19041)
- [ ] Windows 10, version 2104 (Build 20348)
- [ ] Windows 11, version 22H2 (Build 22000)
- [ ] Other (specify)
### Other SDK version
_No response_
### Visual Studio Version
_No response_
### Visual Studio Build Number
_No response_
### Device form factor
_No response_
### Additional context
_No response_
### Help us help you
Yes, but only if others can assist.
Contributor guide
Assessment
This issue has not been assessed yet.