CommunityToolkit/WindowsCommunityToolkit

ImageCropper creates artifacts when switching between images

Open

#3.708 geöffnet am 30. Jan. 2021

Auf GitHub ansehen
 (4 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)C# (1.403 Forks)batch import
bug :bug:help wantedquestion :grey_question:

Repository-Metriken

Stars
 (5.708 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

I am using ImageCropper in an app that allows the user to crop multiple bitmaps before submitting the changes in one batch. The user needs to switch between bitmaps.

I let her select bitmaps through a ListView. Every time the ListView has a new SelectedItem, I grab the current CroppedRegion off the ImageCropper and store it with the bitmap instance. Then I load the newly selected bitmap into ImageCropper and try to set the cropped rect. The bitmap initializes the stored Crop to 0/0/Width/Height...

When switching between bitmaps I notice that the ImageCropper produces wrong crop rectangles and sometimes even artifacts of underlying canvas pixels... Do I need to wait for the load and process to finish???

Anything I am not getting?

Maybe it would be a good idea to make two changes:

  1. Give LoadImageFromFile() an optional parameter Rect? that identifies a desired cropped region
  2. Raise an event every time the user changes the Crop so that the app can track changes by the user

This was posted as a bug in https://github.com/MicrosoftDocs/WindowsCommunityToolkitDocs/issues/400 and was suggested to be posted here as well...

Contributor Guide