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
When specifying BitmapTransform.Rotation = BitmapRotation.Clockwise180Degrees and setting BitmapTransform.Bounds for the Jpeg Bitmap encoder, an ArgumentException is thrown.
Specifying a different rotation flag or excluding the Bounds or choosing a different encoder (Png/Bitmap) it is successful.
Steps to reproduce the bug
Create a Windows application
Target framework 8.0
Any target/supported OS version
The code example below can be used to reproduce the issue
using Windows.Graphics.Imaging;
using Windows.Storage;
using Windows.Storage.Streams;
internal class Program
{
private static async Task Main(string[] args)
{
#if true
var http = new HttpClient();
var response = await http.GetAsync("https://distributedmedical.com/wp-content/uploads/2020/05/DM-Logo_white.png");
var source = response.Content.ReadAsStream().AsRandomAccessStream();
#else
var file = await StorageFile.GetFileFromPathAsync(@"C:\Users\bjorn\Downloads\temp.jpg");
var source = await file.OpenReadAsync();
#endif
// Get bitmap from stream
var decoder = await BitmapDecoder.CreateAsync(source);
var bitmap = await decoder.GetSoftwareBitmapAsync();
// Create rotated and cropped Jpeg
var destination = new InMemoryRandomAccessStream();
var encoder = await BitmapEncoder.CreateAsync(BitmapEncoder.JpegEncoderId, destination);
encoder.SetSoftwareBitmap(bitmap);
encoder.IsThumbnailGenerated = false;
// The combination of rotation = 180 degrees and specified Bounds will throw exception
encoder.BitmapTransform.Rotation = BitmapRotation.Clockwise180Degrees;
encoder.BitmapTransform.Bounds = new BitmapBounds(10, 10, 10, 10);
await encoder.FlushAsync();
}
}
Expected behavior
The input parameters in the example provided should generate an output image rotated and cropped.
Screenshots
No response
NuGet package version
None
Packaging type
Unpackaged
Windows version
Windows 11 version 22H2 (22621, 2022 Update)
IDE
Visual Studio 2022
Additional context
No response
The text was updated successfully, but these errors were encountered:
Describe the bug
When specifying BitmapTransform.Rotation = BitmapRotation.Clockwise180Degrees and setting BitmapTransform.Bounds for the Jpeg Bitmap encoder, an ArgumentException is thrown.
Specifying a different rotation flag or excluding the Bounds or choosing a different encoder (Png/Bitmap) it is successful.
Steps to reproduce the bug
Create a Windows application
The code example below can be used to reproduce the issue
Expected behavior
The input parameters in the example provided should generate an output image rotated and cropped.
Screenshots
No response
NuGet package version
None
Packaging type
Unpackaged
Windows version
Windows 11 version 22H2 (22621, 2022 Update)
IDE
Visual Studio 2022
Additional context
No response
The text was updated successfully, but these errors were encountered: