Coil: RoundedCornersTransformation broken with Coil 1.1.0

Created on 25 Nov 2020  路  7Comments  路  Source: coil-kt/coil

Describe the bug
After updating from 1.0.0 to 1.1.0 images started becoming very narrow and not keep the aspect ratio.
I narrowed it down to RoundedCornersTransformation. If I don't apply the transformation, then the image keeps its aspect ratio.

Expected behavior
RoundedCornersTransformation should work as before with Coil 1.0.0

To Reproduce
Build and run:
https://github.com/clhols/drchannels/tree/coil-issue

Logs/Screenshots
https://www.dropbox.com/s/1qziqi1i9ef7m96/Screenshot%202020-11-25%20at%2020.24.03.png?dl=1
https://www.dropbox.com/s/j989d15xydhpuvu/Screenshot%202020-11-25%20at%2020.23.46.png?dl=1

bug

All 7 comments

Does the ImageView in the screenshot use the CENTER or MATRIX scale types? This may be related to the first change in the 1.1.0 release.

It uses "fit start"

A workaround is to set both layout_width and layout_height of the image view to a fixed DP value.

@clhols Setting fixed size helped you? Without changing the scale type?
I have issues with images, which already had fixed height and weight (24dp). Had to change the scale type from center to centerCrop to get proper size and transformation working.

Here is how user avatar looked after updating to Coil 1.1.0 without any changes (note, right image is a placeholder to show how avatar had to look):
Screenshot 2020-11-27 at 14 48 54
And here is fixed version after I changed the scale type. This is also how avatar looked before updating to 1.1.0.
Screenshot 2020-11-27 at 14 49 52

@vbuberen That change is related to the first change in the 1.1.0 changelog. It was made to ensure that the visual result of an image request is consistent with ImageView.setImageResource/ImageView.setImageURI. The center scale type typically loads the image without scaling it in the ImageView; Coil is now consistent with these other methods.

Thanks for explanations. My previous comment was mostly to the original issue reporter, since he mentioned that setting fixed size helped. It might confuse other people (like it confused me), so I shared how it worked for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

digitalheir picture digitalheir  路  4Comments

ianhanniballake picture ianhanniballake  路  3Comments

r4phab picture r4phab  路  6Comments

SourabhSNath picture SourabhSNath  路  3Comments

cioccarellia picture cioccarellia  路  3Comments