Search code examples
androidimagepicassoandroid-image

Crop image as square with picasso


How can I crop image to square using picasso library on Android?

I need following: cat one

and I also need cat two


Solution

  • The following project provides a lot of different transformations for Picasso

    https://github.com/wasabeef/picasso-transformations

    The one you are interested is named CropSquareTransformation and you can apply it by using the following code

    Picasso.with(mContext)
           .load(R.drawable.demo)
           .transform(transformation)
           .transform(new CropSquareTransformation())
           .into(holder.image);
    

    You could add the dependency or copy and paste the classes you need.