Is there any way in current version to crop image like centerCrop is doing, but to choose where image will be cropped? Something like .centerCrop(Gravity.TOP) or .centerCrop(Gravity.BOTTOM) etc. At this moment Gravity is CENTER.
This is already on master
and will be in the next release.
47878b470 was merged a couple years ago, and doesn't seem to be in any tag. Would love a release at some point. ;-)
Sounds like the ball started rolling towards a 3.0 release, so we'll just have to be patient.
In the meantime, you can do some light cropping with something like this:
private static class TopHalfTransformation implements Transformation {
@Override public Bitmap transform(Bitmap source) {
try {
return Bitmap.createBitmap(source, 0, 0, source.getWidth(), source.getHeight() / 2);
} finally {
source.recycle();
}
}
@Override public String key() {
return "half height";
}
}
Most helpful comment
47878b470 was merged a couple years ago, and doesn't seem to be in any tag. Would love a release at some point. ;-)