使用Picasso设置为Imageview时,为什么图像会自动旋转 [英] Why image auto rotate when set to Imageview with Picasso

查看:427
本文介绍了使用Picasso设置为Imageview时,为什么图像会自动旋转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上传到服务器后,我在模式风景下拍摄了bt相机…是风景.

I take photo bt camera on mode landscape, after upload to server...It was landscape to.

但是当我加载到imageview时,然后像下面的图像一样显示垂直:

But when i load to imageview then display vertical like below image:

我使用毕加索将图像加载到Imageview.I想要像原始图像一样显示在ImageView上... 请给我建议...非常感谢!

I using Picasso to load image to Imageview.I want display like original image on ImageView... Please suggest for me...tks so much!

public static void makeImageRequest(Context context, ImageView imageView, final String imageUrl, ProgressBar progressBar) {
        final int defaultImageResId = R.drawable.ic_member;
        Picasso.with(context)
                .load(imageUrl)
                .error(defaultImageResId)
                .resize(80, 80)
                .into(imageView);
                }

ImageView:

ImageView:

<ImageView
                                android:layout_centerInParent="true"
                                android:padding="@dimen/_8sdp"
                                android:id="@+id/img_photo"
                                android:layout_width="@dimen/_80sdp"
                                android:layout_height="@dimen/_80sdp"
                                android:layout_gravity="center"
                                android:scaleType="fitCenter"
                                android:adjustViewBounds="true" />

URL:

https://arubaitobsv.s3-ap-northeast-1.amazonaws.com/images/1487816629838-20170223_092312_HDR.jpg

推荐答案

问题出现在此处

毕加索自动将来自网络的图像旋转90度,该图像具有以下EXIF数据:

Picasso auto rotates by 90 degrees an image coming from the web that has the following EXIF data:

Resolution : 3264 x 2448
Orientation : rotate 90

使用毕加索尝试以下代码:

try this code with picasso:

Picasso.with(MainActivity.this)
    .load(imageURL) // web image url
    .fit().centerInside()
    .transform(transformation)
    .rotate(90)                    //if you want to rotate by 90 degrees
    .error(R.drawable.ic_launcher)
    .placeholder(R.drawable.ic_launcher)
    .into(imageview)
    });

您还可以使用Glide:

You can also use Glide:

    dependencies {
  // Your app's other dependencies
  compile 'com.github.bumptech.glide:glide.3.7.0'
}

使用以下图像的原始图像

laod image using:

Glide.with(this).load("image_url").into(imageView);

这篇关于使用Picasso设置为Imageview时,为什么图像会自动旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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