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

Manifest icons with purpose any and maskable do not adhere to the spec #778

Open
atjn opened this issue Jan 2, 2022 · 4 comments
Open
Labels
bug Something isn't working

Comments

@atjn
Copy link
Collaborator

atjn commented Jan 2, 2022

When generating images for the web app manifest, PAG currently generates two copies of each size; one with purpose maskable and one with purpose any. PAG generates these two copies as identical, but if you look at the documentation for these purposes, you will find that they should not be identical:

  • any should have almost no padding, as is expected from traditional icons that are shown as favicons and used in splash screens.
  • maskable should have a lot of padding, and should adhere to a very strict standard for the size of the padding, as it is specifically designed to let the operating system cut away large portions of the image, to make it fit in custom shapes.

The way the images are padded right now, seem to be a sort of in-betweeny, where there is slightly too much padding for an any purpose, and slightly too little padding for a maskable purpose.

In order to fix this problem, the padding system has to be much more sophisticated. I believe it will have to auto-detect which parts of the image are padding, and then add/remove padding to fit these purposes.

One way to do that, could be to find the smallest possible centered circle for an image, where every pixel outside the circle is the exact same color (transparent is also a color in this context). Then the image could be cut to exactly fit this circle, generating a base image where the logo is known to be as large as possible. When that base image exists, it should be trivial to create different image types with varying amounts of padding, that hit precise targets of % padding.

Related:
#725
#679

@atjn atjn added the bug Something isn't working label Jan 2, 2022
@dantman
Copy link

dantman commented Jan 19, 2022

Wouldn't this be solved if there were different padding options for favicons, splash screens, and maskable icons? It doesn't really make sense to use the same for all of them.

@dantman
Copy link

dantman commented Jan 20, 2022

Actually I think instead of a --masked-padding option I'd prefer being able to use an alternate maskable source. Perhaps we need a --maskable-only/--no-maskable pair of options that would only generate maskable icons or generate non-maskable icons without altering the definitions for maskable icons.

Then we can generate maskable and non-maskable icons with any options we want, just like with favicons, app icons, and splash screens now.

@atjn
Copy link
Collaborator Author

atjn commented Jan 29, 2022

Sure, it would also be great to have extra options that allows for customizing what PAG outputs. But we also need the default settings to work properly.

@dantman
Copy link

dantman commented Jan 29, 2022

Assuming we can't make --maskable behave like the --maskable-only and pair it with a --no-maskable. --maskable should probably be deprecated. So the default setting is to only output non-maskable icons, but not delete maskable icons from the manifest. So you can then separately add a run to generate maskable icons with different parameters. I guess it would make sense for this to also change the default --padding.

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

2 participants