Search code examples
androidpicasso

how to use Picasso library to cut the image from bottom only


I'm using the below code to load the image into an imageView.I want to cut the image from the bottom only. how can I do this using Picasso Tried center-crop and image cut from top and bottom

  Picasso.with(getContext())
                    .load(imageUrl)
                    .fit()
                    .into(imageView);

Solution

  • Using transform you can crop the image based on the gravity.

    Picasso.with(mContext)
           .load(imageUrl)
           .transform(new CropTransformation(500,150),  CropTransformation.GravityHorizontal.CENTER, CropTransformation.GravityVertical.TOP))
           .into(imageView);
    

    The above code will cut the image from the bottom only.

    You can get CropTransformation library here.