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

Coil does not upscale resources #76

Closed
r4phab opened this issue Aug 29, 2019 · 6 comments · Fixed by #183
Closed

Coil does not upscale resources #76

r4phab opened this issue Aug 29, 2019 · 6 comments · Fixed by #183
Labels
bug Something isn't working
Milestone

Comments

@r4phab
Copy link

r4phab commented Aug 29, 2019

Describe the bug
When I download a resource from URL and its size is smaller than the requested size in the GetRequestBuilder, result is not upscaled. On the contrary, when I set a smaller size inside my GetRequestBuilder, the resource is correctly downscaled.

To Reproduce
Download this image using Coil.get(url) { size(256, 256) }

Expected behavior
I would expect to have a resulting drawable of 256x256 instead of the 24x24 provided

Library version
0.6.1

@r4phab r4phab added the bug Something isn't working label Aug 29, 2019
@colinrtwhite
Copy link
Member

@r4phab This is currently intended behaviour. Coil avoids loading images at a larger size than necessary to conserve memory. This behaviour is also fairly core to how Coil handles the dynamic sampling crossfade effect.

If you need to upscale an image, I'd recommend creating a Transformation that scales the input Bitmap. If you're drawing to a Canvas, you can also scale the Bitmap using drawBitmap.

@colinrtwhite
Copy link
Member

colinrtwhite commented Oct 8, 2019

Quick update on this issue. I probably won't have time to address this for 0.8.0, but will try to tackle it the subsequent release. The plan is to add ImageLoader-specific and Request-specific config flags to disable this optimization.

@colinrtwhite colinrtwhite changed the title Size does not upscale downloaded resources Coil does not upscale resources Oct 8, 2019
@r4phab
Copy link
Author

r4phab commented Oct 24, 2019

Thank you @colinrtwhite for your prompt response and your explanations

@colinrtwhite
Copy link
Member

colinrtwhite commented Nov 30, 2019

This is now fixed in master. To get the fix asap you can depend on 0.9.0-SNAPSHOT.

See #183 for more info on the implementation, but TLDR Coil will now ensure the loaded image's dimensions are as requested for custom targets and Coil.get.

@bishiboosh
Copy link

@colinrtwhite just to know, when are you planning to release 0.9.0 ? Just to know if I need to use some workarounds or wait a little bit

@colinrtwhite
Copy link
Member

colinrtwhite commented Dec 9, 2019

@bishiboosh I'd estimate in the next 1-2 weeks. Definitely before December 25th.

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

Successfully merging a pull request may close this issue.

3 participants