CommunityToolkit / CommunityToolkit/Windows

About the issue of ImageCropper missing a pixel from a cropped image

Open
#675 0 comments 0 reactions 0 assignees View on GitHub
bug components::controls::imagecropper
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.

![Image](https://github.com/user-attachments/assets/e38ea86c-796d-4726-947d-3dd4ade8e8fa)

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

![Image](https://github.com/user-attachments/assets/f388c0c3-80a1-4fd2-85cf-055fe2fb533c)

### Screenshots

The picture below shows the operation diagram of cutting
![Image](https://github.com/user-attachments/assets/f38314cb-a77e-4f7a-a8f6-05d38ae9daa7)

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

![Image](https://github.com/user-attachments/assets/648ea5c3-b151-4e28-bba7-d9aae799e3ab)

### 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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.