dotnet / dotnet/maui

Improve the image generation for specific use cases

Open
#11,099 5 comments 5 reactions 0 assignees View on GitHub
area-controls-image platform/android platform/ios platform/macos platform/windows t/enhancement ☀️
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 15h
Merged PRs (30d)
290

Description

### Description

Several people have hit the issue where they put images in the `Resources/Images` folder and try use it in specific locations in the app - for example tab icons.

This makes sense as they want an image on the tab, but some platforms/controls do not resize the image. So as a result this happens: https://github.com/dotnet/maui/issues/8609 - the tab icons are the original size in the svg file.

In Xamarin.Forms, I believe images were not generated automatically so this was never hit because images were already sized correctly.

And this is where doing things automagically is really deceiving: if you have a large image - say 1024x1024 (because you got that from a designer or that is just the size the drawing app used) - then you actually force the OS to load that HUGE image and then scale it down to 20x20 at runtime. This definitely impacts startup performance - even in release builds.

Your app will have several large image files (increasing file size) and then the app has to load those images (long load times) and then has to resize those image (even more load time).

I am going to close this issue "as designed" because the BaseSize attribute is specifically what it was designed for. Maui has no way of knowing what the image is going to be used for and thus it is up to you to create images or set scaling so that the tooling can generate the correct images.

### Steps to Reproduce

1. Create a new MAUI app
2. Add a large SVG into Resources/Images
3. Set the image as the tab icon

### Link to public reproduction project repository

See https://github.com/dotnet/maui/issues/8609

### Version with bug

Unknown/Other (please specify)

### Last version that worked well

Unknown/Other

### Affected platforms

iOS, Android, Windows, macOS, Other (Tizen, Linux, etc. not supported by Microsoft directly)

### Affected platform versions

All

### Did you find any workaround?

The current way is to use `BaseSize` as it was designed to do this, but this is not discoverable.

Maybe the IDE needs more things in the properties pane?

### Relevant log output

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the linked reproduction in issue #8609 and review how the Resources/Images and BaseSize workflow is documented or exposed in the IDE. The issue names no source files or tests; done would require an agreed solution for making use-specific image sizing discoverable without changing the current BaseSize design.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop-dev, frontend, mobile-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.