You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to work with ImageCropper to generate a cropping region, I am forced to use WriteableBitmap.
While I understand that some parts of the components will want to work with a WriteableBitmap, but that is not the case for the core UI function of selecting a cropping zone.
This prevents for example, one from using BitmapImages which support animated images.
It should be perfectly reasonable to allow users to use the component only for its UI presentation features, and implement the cropping themselves if they desire to.
Steps to reproduce
Try loading an animated image into the ImageCropper. It will only show the first frame.
Setting a BitmapImage loaded externally as the source is not possible.
Expected behavior
ImageCropper should accept any BitmapSource as an input (as it contains the properties PixelWidth and PixelHeight that are used everywhere). ImageCropper should throw an exception if methods that require the Source to be a WriteableBitmap are called when the Source is of a different type.
The ImageCropper should accept images that are loaded asynchronously, as a BitmapSource is not guaranteed to have dimensions until the image is actually loaded. It is already a problem on the current implementation using WriteableBitmap. (If one is creating a 1x1 bitmap before asynchronously loading the image, ImageCropper will reject it)
This can be addressed by listening for changes to PixelWidth and PixelHeight properties instead of rejecting the Source. (using RegisterPropertyChangedCallback
In case any of those properties are not valid, it should be possible for the ImageCropper to simply consider the image as not being assigned, which will make it work more gracefully in different scenarios.
Help us help you
Yes, I'd like to be assigned to work on this item.
The text was updated successfully, but these errors were encountered:
Describe the bug
Trying to work with
ImageCropper
to generate a cropping region, I am forced to useWriteableBitmap
.While I understand that some parts of the components will want to work with a
WriteableBitmap
, but that is not the case for the core UI function of selecting a cropping zone.This prevents for example, one from using
BitmapImages
which support animated images.It should be perfectly reasonable to allow users to use the component only for its UI presentation features, and implement the cropping themselves if they desire to.
Steps to reproduce
Expected behavior
ImageCropper
should accept anyBitmapSource
as an input (as it contains the propertiesPixelWidth
andPixelHeight
that are used everywhere).ImageCropper
should throw an exception if methods that require theSource
to be aWriteableBitmap
are called when theSource
is of a different type.Screenshots
No response
Code Platform
Windows Build Number
Other Windows Build number
No response
App minimum and target SDK version
Other SDK version
10.0.22621.48
Visual Studio Version
2022
Visual Studio Build Number
No response
Device form factor
Desktop
Additional context
AFAIK, the only part that actually requires the source to be a
WriteableBitmap
is https://github.com/CommunityToolkit/Windows/blob/main/components/ImageCropper/src/ImageCropper.Helpers.csThe
ImageCropper
should accept images that are loaded asynchronously, as aBitmapSource
is not guaranteed to have dimensions until the image is actually loaded. It is already a problem on the current implementation using WriteableBitmap. (If one is creating a 1x1 bitmap before asynchronously loading the image,ImageCropper
will reject it)This can be addressed by listening for changes to
PixelWidth
andPixelHeight
properties instead of rejecting the Source. (using RegisterPropertyChangedCallbackIn case any of those properties are not valid, it should be possible for the
ImageCropper
to simply consider the image as not being assigned, which will make it work more gracefully in different scenarios.Help us help you
Yes, I'd like to be assigned to work on this item.
The text was updated successfully, but these errors were encountered: