Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Problem/Bug]: FavIcon returned by GetFaviconAsync always blurry #4915

Closed
johanneswanzek opened this issue Nov 11, 2024 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@johanneswanzek
Copy link

What happened?

When I use WebView2 "GetFaviconAsync" Method in my App the Favicons are blurry when displayed in larger sizes > 16 px.
I suppose this Method only returns Favicons in 16x16 which is suboptimal for my purpose and I dont want to switch to download the FavIcon manually when I already have this Method.

Is there a chance to make this Method return more quality Favicons?

Importance

Important. My app's user experience is significantly compromised.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

130.0.2849.80

SDK Version

1.0.2849.39

Framework

WPF

Operating System

Windows 11

OS Version

No response

Repro steps

I am using this code to create the BitmapSource

await using var iconAsStream = await webView.CoreWebView2.GetFaviconAsync(CoreWebView2FaviconImageFormat.Png);
var bitmap = new BitmapImage();
bitmap.BeginInit();
bitmap.StreamSource = iconAsStream;
bitmap.CacheOption = BitmapCacheOption.OnLoad;
bitmap.EndInit();

Icon = bitmap;

This code was also used:
await using var iconAsStream = await webView.CoreWebView2.GetFaviconAsync(CoreWebView2FaviconImageFormat.Png);

var decoder = new PngBitmapDecoder(iconAsStream, BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
BitmapSource bitmapSource = decoder.Frames[0];

Icon = bitmapSource;

Result Image in Size 32x32 px

image

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

No, this never worked

Last working version (if regression)

No response

@johanneswanzek johanneswanzek added the bug Something isn't working label Nov 11, 2024
@llehn
Copy link

llehn commented Nov 12, 2024

I'm having the same problem TBH

@sandeepchads
Copy link

Apologize for the inconvenience.

Have you tried using SVG files and retrieving them using the CoreWebView2.FaviconUri property and then handle the SVG to PNG conversion using libraries like SkiaSharp. This approach is mentioned in a GitHub issue.

@sivMSFT
Copy link

sivMSFT commented Nov 22, 2024

Hi @johanneswanzek & @llehn,

We are closing this, as you can find a solution here: 2812. Please let us know if you continue to experience any problems.

@sivMSFT sivMSFT closed this as completed Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants