How do I get back those good old pixels in my image?

At0m 20 Reputation points
2026-09-15T19:03:13.38+00:00

ENG:

When I have a lot of empty space on the canvas, the corners of my pixels change color, which makes the image look low-quality; it’s incredibly frustrating to spend hours meticulously placing every single pixel, only to run into this problem.

RUS:

Когда на холсте много пустого пространства, углы пикселей меняют цвет, из-за чего изображение выглядит некачественным; невероятно обидно часами кропотливо расставлять каждый пиксель, чтобы в итоге столкнуться с такой проблемой.

Windows development | WinUI
0 comments No comments

Answer accepted by question author
Gatlin Le (WICLOUD CORPORATION) 560 Reputation points Microsoft External Staff Moderator
2026-09-16T02:44:54.1333333+00:00

Hi @At0m ,

Based on your description, this behavior is most likely related to how the image is being scaled rather than the original pixel colors being changed.

In WinUI, when an Image is displayed at a size different from its source dimensions, the image is scaled according to its layout size and Stretch setting. For pixel art, scaling at a non-integer ratio can blend neighboring pixels, including transparent edge pixels, which can make the corners appear to change color.

As a first check, try displaying the image at its native size, or scale it only by whole-number multiples such as 2×, 3×, or 4×. Also make sure that its parent Canvas is not stretching the Image to a fractional size.

For example:

<Image

    Source="Assets/MyImage.png"

    Width="128"

    Height="128"

    Stretch="Fill"

    UseLayoutRounding="True" />

The width and height above should be exact whole-number multiples of the source image dimensions. UseLayoutRounding can help prevent fractional layout coordinates, but it does not disable image interpolation by itself.

Microsoft’s documentation explains how the Image control scales content through its Stretch property: Images and image brushes

If the image still changes after using an exact integer scale, please share the relevant Image and Canvas XAML, the source image dimensions, and the final displayed dimensions, making sure to remove any personal or sensitive information before posting. This will help us determine whether the remaining issue is related to layout scaling, DPI scaling, or bitmap rendering.

If you found my response helpful or informative, I would greatly appreciate it if you could follow this guidance or provide feedback.

Thank you.

Was this answer helpful?

1 person found this answer helpful.

0 additional answers

Sort by: Newest

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.