Picasso is a widely used library in Android Studio. It helps to load images of various formats. Images can be edited, resized and cropped using Picasso. It is named after the famous Spanish painter Pablo Picasso.
Steps to use Picasso:
1. In build.gradle, add implementation ‘com.squareup.picasso:picasso:2.5.2’
2. In Manifest file, add <users-permission android:name=”android.permission. INTERNET”/>
3. In layout file, add an <ImageView />
4. In Activity Java file, import the library by adding “import com.squareup.picasso.Picasso;” statement
5. Loading the image inside the Activity Java file:
ImageView imageView = findViewById(R.id.imageView);
Picasso.with(this)
.load(“url/img”)
.into(imageView);
6. To resize, simply add this to the Picasso instance:
.resize(size, size);
7. To add a placeholder, simply add this to the Picasso instance:
.placeholder(R.mipmap.ic_launcher);
8. To crop and make it fit, add this to the Picasso instance:
.centerCrop()
.fit();
Any further information can be found at https://github.com/square/picasso .