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

Fix cropping centering #91

Open
aeirola opened this issue Apr 9, 2022 · 1 comment
Open

Fix cropping centering #91

aeirola opened this issue Apr 9, 2022 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@aeirola
Copy link
Owner

aeirola commented Apr 9, 2022

Currently the cropping logic produces slightly off-center icons on very low resolutions. This is especially noticeable on the un-even sizes in iOS notification icons (29px, etc.).

The issue is due to the fact that the icon is first rendered as a low-resolution PNG, from which a certain center section of whole pixels is extracted. Since the cropping needs to be performed on whole pixels, this causes a small "shift" when the input and output resolutions do not match.

Some possible solutions:

  • Render the SVG at a higher resolution, crop and downscale
  • Modify the SVG viewBox attribute to produce the desired crop directly during SVG rendering
@aeirola aeirola added the bug Something isn't working label Apr 9, 2022
@aeirola aeirola added this to the 1.0.0 milestone Apr 9, 2022
@aeirola aeirola self-assigned this Apr 9, 2022
@aeirola
Copy link
Owner Author

aeirola commented Apr 9, 2022

Here you can see how the first icon is slightly shifted to the bottom right, while the latter is more centered.

ipad-29@1x ipad-40@1x

Yes, the effect is quite subtle, but still annoying once you see it.

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

1 participant