Open kiddailey opened 4 months ago
As a workaround for this, I've implemented a change to the IconImage.Save() method with PR #24 that can take an additional "size" parameter. In this way, the caller can scale the image proportionally when saving.
It's not perfect as the Fetcher will still be storing a collection of potentially large images in memory, but feels like a good compromise for the time being.
Edit: I moved the code for this into the SVG support branch and pull request as I needed it there anyway and closed the original PR. Keeping this open for discussion on the original idea.
Also SkiaSharp's Resize method isn't the best :/
Use case
Display an icon at 64x64, using the best possible quality from the icons available, and always display an icon if any are available.
For example, let us say that I specify the following:
And let's also say that a site provides the following icon types:
For the request with my above min/max/perfect parameter, FaviconFetcher will return the 16x16 image due to the distance calculation:
However, in this sample use-case, scaling the 16x16 up to 64x64 would look terrible, especially when a much better result would come from scaling down the 120x120.
Feature Request
Alternatives
Consumer could specify a larger MinSize
Consumer could ask for a large Max/PerfectSize and perform a scale down on the fetch result separately
Consumer could ask for a large Max/PerfectSize and embed result directly
Thoughts?