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

Add a CenterCropTransformation #56

Closed
ghost opened this issue Aug 21, 2019 · 6 comments
Closed

Add a CenterCropTransformation #56

ghost opened this issue Aug 21, 2019 · 6 comments
Labels
enhancement New feature or request

Comments

@ghost
Copy link

ghost commented Aug 21, 2019

Reference: https://github.com/bumptech/glide/blob/d8278f43a94484f20822170b71ac7b66269a2aa6/library/src/main/java/com/bumptech/glide/load/resource/bitmap/CenterCrop.java

Sometimes in some combination transformations, it is possibly important

@ghost ghost added the enhancement New feature or request label Aug 21, 2019
@colinrtwhite
Copy link
Member

I'd like to avoid adding new transformations to the base coil artifact. I'd check out https://github.com/Commit451/coil-transformations, which is the Coil counterpart to glide-transformations and already has support for a center crop transformation.

@chachako
Copy link

@colinrtwhite I think these should be built into the coil because it is the basic conversion, such as centerCrop, fitCenter

@colinrtwhite
Copy link
Member

@VVVenom If you're loading into an ImageView Coil will automatically detect its scaleType and load the image at the correct dimensions so it fits/fills the view.

@chachako
Copy link

chachako commented Dec 23, 2019

@VVVenom If you're loading into an ImageView Coil will automatically detect its scaleType and load the image at the correct dimensions so it fits/fills the view.

If I set the background for the View, I should use CenterCropTransform(viewHeight: Int, viewWidth: Int) / CenterCropTransform(view: View)

Obviously this is useful in certain situations.

@artyomefimov
Copy link

@VVVenom If you're loading into an ImageView Coil will automatically detect its scaleType and load the image at the correct dimensions so it fits/fills the view.

@colinrtwhite What will happen if my imageView has, for example, scaleType = fitCenter and I add transformations(CircleCropTransformation()) via code. Will both of them be applied or only fitCenter will?

@Jeevuz
Copy link

Jeevuz commented Jan 25, 2022

Crop will be useful, because without it the base transformation RoundedCornersTransformation can't be used as desired:
A big image with RoundedCornersTransformation added and centerCrop set in ImageView will lead to no rounded corners because ImageView will crop them. And to prevent this we need another library with crop or other method of adding rounded corners to our ImageView. This is not what someone expects from bulletproof library ;) (Nice library, btw, thanks!)
@colinrtwhite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants