PowerToys icon indicating copy to clipboard operation
PowerToys copied to clipboard

[Peek] Missing image aliasing

Open OmbraRD opened this issue 2 years ago • 5 comments

Microsoft PowerToys version

0.72.0

Installation method

Microsoft Store

Running as admin

Yes

Area(s) with issue?

Peek

Steps to reproduce

Create an image (tested PNG and JPEG) with diagonal clean lines and preview it with peek

✔️ Expected Behavior

Preview should look the same as when opening the image with Photos

❌ Actual Behavior

Image is lacking aliasing Screenshot 2023-08-28 144501

Other Software

No response

OmbraRD avatar Aug 28 '23 18:08 OmbraRD

Easy way to repro this is do a full desktop screenshot with text.

crutkas avatar Aug 31 '23 04:08 crutkas

Hi, Can you share the 1.png file so I can work with the same file and test the changes? Thanks, /needinfo

gokcekantarci avatar Feb 08 '24 11:02 gokcekantarci

00eb963f65720ecda375925efbf9971f98db34371246fadf43e15f8a0fcf93e0 I can't find the original image but it is noticeable with any image that has sharp details. Here is another one

OmbraRD avatar Feb 19 '24 19:02 OmbraRD

Hi,

After thorough investigation and multiple attempts to address the image aliasing issue reported in Peek, I've determined that the root cause is tied to limitations within WinUI 3, specifically regarding the RenderOptions.BitmapScalingMode property. Despite extensive efforts to find a workaround or alternative solution within the scope of Peek's implementation, the limitation persists, impacting our ability to deliver high-quality image aliasing.

During the investigation, the following steps were taken to attempt to resolve the issue:

  1. Experimented with various image rendering options available within WinUI 3 to improve aliasing.
  2. Tested different image formats and resolutions to assess the impact on the aliasing quality.
  3. Tried with some other libraries.
  4. Searched the WinUI 3 documentation and community forums for potential undocumented workarounds or insights.

Unfortunately, due to the current constraints of WinUI 3, specifically the lack of support for setting BitmapScalingMode to "HighQuality," we're unable to achieve the desired image quality in Peek. This limitation not only affects Peek but potentially other applications developed with WinUI 3 that require high-quality image rendering.

To address this broader issue and seek solutions or workarounds, I have opened a new issue in the WinUI repository detailing this limitation and its impact on application development. You can find the issue here: https://github.com/microsoft/microsoft-ui-xaml/issues/9380

We will continue to monitor any updates or changes in WinUI 3 that might allow us to revisit and resolve this image quality issue in Peek.

Thank you for your understanding and support as we work through these technical challenges.

gokcekantarci avatar Mar 01 '24 15:03 gokcekantarci

Quick solution would be to load the Image in XAML where possible, and not with a BitmapImage from codebehind - although if an explicit BitmapImage is actually needed (going by the code it does not look like it is), you can check the guidance for Right-sized decoding on this page https://learn.microsoft.com/en-us/windows/uwp/debug-test-perf/optimize-animations-and-media in regards to letting XAML render the image with better quality initially, circumventing this rendering behaviour (which is used for performance reasons).

(And if the codebehind decoding method is being stuck with, cancellationToken.ThrowIfCancellationRequested(); should be checked directly before Preview is set anywhere as there are async methods between it and the initial token check)

JohnnyWestlake avatar Mar 09 '24 22:03 JohnnyWestlake

Fixed in the latest version! 🙂

Jay-o-Way avatar May 29 '24 16:05 Jay-o-Way