Glide: crop from top and not center

Created on 11 Oct 2016  路  3Comments  路  Source: bumptech/glide

I want to put an image in the imageview using glilde. I want the image to be croped from top rather than center

question

Most helpful comment

I think you can just say 0,0,TOP as in the default constructor, though it looks weird because it doesn't use outWidth. You may have to copy and modify that transformation to use the "out" size instead of mWidth or source.getWidth to make it more flexible/efficient. You can try to open an issue with him to see why it's behaving this way.

All 3 comments

you mean:

.bitmapTransform(new CropTransformation(context,300,100,CropTransformation.CropType.TOP))

but is it possible to avoid the dimensions. or not mention them. I want autofit with crop-top

I think you can just say 0,0,TOP as in the default constructor, though it looks weird because it doesn't use outWidth. You may have to copy and modify that transformation to use the "out" size instead of mWidth or source.getWidth to make it more flexible/efficient. You can try to open an issue with him to see why it's behaving this way.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kenneth2008 picture kenneth2008  路  3Comments

MrFuFuFu picture MrFuFuFu  路  3Comments

piedpiperlol picture piedpiperlol  路  3Comments

r4m1n picture r4m1n  路  3Comments

Morteza-Rastgoo picture Morteza-Rastgoo  路  3Comments