You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When I have CrossfadeTransition.Factory() passed to the ImageLoader, I get a different final scale in an AsyncImage if it uses a placeholder that is larger than the final image. Everything is fine if I remove the crossfade, remove the placeholder, or use a placeholder that matches the size of the final image.
You can clone the repo, run the code, and observe that:
If we keep CrossfadeTransition.Factory() around, we'll get different scaling results depending on whether we keep or remove the placeholder.
If we remove CrossfadeTransition.Factory(), the scaling is the same regardless if we have the placeholder or not.
If we keep CrossfadeTransition.Factory() but change the placeholder from R.drawable.placeholder_larger to R.drawable.placeholder, which has the exact same size as our final imagem, then everything is fine.
Logs/Screenshots
Image on the left is what we get with crossfade and the large placeholder. Image on the right is the correct scaling which we get by either removing the crossfade, removing the placeholder, or using a placeholder that matches the final image size.
We're using ContentScale.Crop above, but we can move to ContentScale.Fit to make the difference more visible:
Version
Coil 2.3.0, reproduced on a Pixel 4 running Android 13 and on a Pixel 6 emulator (1080x2400 420dpi) running Android 10 (screenshots from the latter).
The text was updated successfully, but these errors were encountered:
True! After reading through it I thought the issue would also happen with a smaller placeholder that has a different aspect ratio, but it doesn’t. The placeholder needs to have a different aspect ratio, but must be larger. I tested it with a larger placeholder that has the same aspect ratio and the issue didn’t happen.
I pushed one more commit in my project adding more placeholder variations and updating my comment just so it’s also easy to verify that:
Issue doesn’t happen if placeholder is smaller, even if it has a different aspect ratio
Issue doesn’t happen if the placeholder is larger but has the same aspect ration
Describe the bug
When I have
CrossfadeTransition.Factory()
passed to theImageLoader
, I get a different final scale in anAsyncImage
if it uses a placeholder that is larger than the final image. Everything is fine if I remove the crossfade, remove the placeholder, or use a placeholder that matches the size of the final image.To Reproduce
Minimum reprodicible example here: https://github.com/tfcporciuncula/coil-crossfade
You can clone the repo, run the code, and observe that:
CrossfadeTransition.Factory()
around, we'll get different scaling results depending on whether we keep or remove the placeholder.CrossfadeTransition.Factory()
, the scaling is the same regardless if we have the placeholder or not.CrossfadeTransition.Factory()
but change the placeholder fromR.drawable.placeholder_larger
toR.drawable.placeholder
, which has the exact same size as our final imagem, then everything is fine.Logs/Screenshots
Image on the left is what we get with crossfade and the large placeholder. Image on the right is the correct scaling which we get by either removing the crossfade, removing the placeholder, or using a placeholder that matches the final image size.
We're using
ContentScale.Crop
above, but we can move toContentScale.Fit
to make the difference more visible:Version
Coil 2.3.0, reproduced on a Pixel 4 running Android 13 and on a Pixel 6 emulator (1080x2400 420dpi) running Android 10 (screenshots from the latter).
The text was updated successfully, but these errors were encountered: