Skip to content

No antialias in Image in very specific case #10870

@fabianoriccardi

Description

@fabianoriccardi

Describe the bug

The image is no antialiased when loaded from code in the following specific case. In the following screenshot you can clearly see the difference.

Image

Why is this important?

The image loaded in such way looks like early 2000, it contrasts with Fluent UI.

Steps to reproduce the bug

<Image Name="PixelatedImage" Height="48" />
<Image Name="GoodImage" Height="48" />
StorageFile fi = await StorageFile.GetFileFromPathAsync("..../github.png");

BitmapImage bitmapImage1 = new();
using IRandomAccessStream stream = await fi.OpenAsync(FileAccessMode.Read);
await bitmapImage1.SetSourceAsync(stream);
PixelatedImage.Source = bitmapImage1;

BitmapImage bitmapImage2 = new();
using IRandomAccessStream stream2 = await fi.OpenAsync(FileAccessMode.Read);
GoodImage.Source = bitmapImage2;
await bitmapImage2.SetSourceAsync(stream2);

The difference betwween the 2 is the order between Source assignation and BitmapImage.SetSourceAsync.

Actual behavior

The actual behavior is visibile in the screenshot.

Expected behavior

No response

Screenshots

Image

NuGet package version

WinUI 3 - Windows App SDK 1.8.2: 1.8.251003001

Windows version

Windows 10 (21H2): Build 19044

Additional context

A very similar issue was already present in uwp https://stackoverflow.com/questions/42189063/image-smoothing-in-uwp-app

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-ImagesImages, SVGbugSomething isn't working

    Type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions