裁剪图像作为广场与毕加索 [英] Crop image as square with picasso

查看:166
本文介绍了裁剪图像作为广场与毕加索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Android上的毕加索库将图像裁剪成方形?

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

我需要关注:
cat one cat two

推荐答案

以下项目为毕加索提供了许多不同的转换

The following project provides a lot of different transformations for Picasso

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

您感兴趣的名为 CropSquareTransformation ,您可以使用以下代码来应用它

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.

这篇关于裁剪图像作为广场与毕加索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆