-
-
Notifications
You must be signed in to change notification settings - Fork 531
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
Wrong image scaling in SwiftUI (layout size is calculated in pixels) #746
Comments
I think the issue it due to coalescing and/or caching of the requests. The framework tries to minimize the amount of work and reuse the existing cached images and download and processing tasks. The issue is that the I haven't fully confirmed this hypothesis as it's a bit tricky to test, but it seems to be the case.
Yes, that's the intended way to use it, and is a replacement for the |
My suggestions would be to either make sure you use the same scale every time OR disable coalescing using pipeline's configuration. I'm also going to mark it as a defect because the scale parameter should never break caching or coalescing. There may also be a need for a different API or implementation for setting the scale. Maybe it should be something similar to the |
The coalescing issue were fixed in Nuke 12.6. |
As of now LazyImage renders remote images with the scale of 1 instead of using the scale of the screen. From what I could tell, there's no way of showing the image with the proper scaling without using
.resizable()
modifier which degrades performance as you and a few other devs talked about here. I've tried:Resize
processor...but nothing works except if
.resizable()
is present.AsyncImage
has an optionalscale
parameter that fixes that, but there's no similar alternative in Nuke.Take this image as a sample, which has a size of 96x96. In my iPhone 14 Pro, which has a screen scale of 3, it should show as a rectangle with the size of 32x pts, but instead it renders as a 96x pts image. The same happens with AsyncImage if
scale
param is not set.Here's a code sample which tests all the alternatives:
This is the the result:
Is there anything I'm missing or is the expected behavior?
The text was updated successfully, but these errors were encountered: