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

Small SVG renders blurry on watchOS #27

Closed
Maxador opened this issue Dec 11, 2020 · 1 comment · Fixed by #28
Closed

Small SVG renders blurry on watchOS #27

Maxador opened this issue Dec 11, 2020 · 1 comment · Fixed by #28

Comments

@Maxador
Copy link
Contributor

Maxador commented Dec 11, 2020

If I try to render an SVG with a bigger size than the SVG file is setting, the image will render blurry.
I tried to use the solution proposed in #24 but without success.
I had it kinda working by setting values to my CGSize like this [.imageThumbnailPixelSize : CGSize(width: 34, height: 34)] but unfortunately not all my images are square and I don't want to constraint the width.

SwiftUI Rendering code

WebImage(url: imageURL), context: [.imageThumbnailPixelSize : CGSize.zero])
            .renderingMode(.template)
            .resizable()
            .placeholder(Image(systemName: "photo"))
            .scaledToFit()
            .frame(height: 34)
            .padding(.bottom, 6)
CGSize.zero CGSize(width: 34, height: 34)
Simulator Screen Shot - Apple Watch Series 6 - 44mm - 2020-12-11 at 09 28 24 Simulator Screen Shot - Apple Watch Series 6 - 44mm - 2020-12-11 at 09 30 20

Is there a way to render the bitmap to a certain height without requesting a width while keeping the aspect ratio of the image?

@dreampiggy
Copy link
Collaborator

dreampiggy commented Dec 14, 2020

Is there a way to render the bitmap to a certain height without requesting a width while keeping the aspect ratio of the image?

Sounds like a new feature request. Can't you pre-calculate the size of length and disable the aspect ratio ?

If you can't, we have to provide some new options, or even like a calculation size block closure for advanced use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants