Placeholder affects image scaling when we use CrossfadeTransition and the placeholder image is larger #1688
Labels
help wanted
Issues that are up for grabs + are good candidates for community PRs
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: