事实上Glide会对旋转的图片正确处理,比如你在三星手机上拍照旋转了90度,用Glide 加载的话,会正确显示。
通过Glide 强大的图片变换功能,我们也可以旋转图片,关于Glide 的图片变换请参考:Android图片加载框架最全解析(五),Glide强大的图片变换功能,关于图片旋转请参考 :Android 效率开发之图片旋转处理,图片旋转的本质是相同的,如下:
自定义图片变换类继承BitmapTransformation :
/**
* 旋转变换
*/
public class RotateTransformation extends BitmapTransformation{
//旋转默认0
private float rotateRotationAngle = 0f;
public RotateTransformation(Context context ,float rotateRotationAngle)
{
super(context);
this.rotateRotationAngle = rotateRotationAngle ;
}
@Override
protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) {
Matrix matrix = n