毕加索自动旋转从相机拍摄的照片,但不旋转从互联网下载的图像
Picasso auto rotate photo captured from camera, but not rotate image downloaded from internet
我正在写一个应用程序。我的应用将从图库中 select 照片。我用 Picasso 加载 Image 到 ImageView。
问题是 Picasso 会自动旋转从相机拍摄的任何照片,但不会旋转任何从互联网下载并保存到内部存储器的图像
这是从网上下载的图片:
这是相机拍的照片,Picasso 自动旋转它,我要修复它:
这是我的代码:
picasso
.load(uriPhoto)
.resize(newWidthBitmap.toInt(), newHeightBitmap.toInt())
.centerInside()
//.rotate(90f)
.into(target_image)
首先交叉检查您的相机图像位图是否旋转,因为某些手机(如三星 s4)在从相机拍摄图像时会将图像旋转 90 度。如果图片未旋转,则使用滑行加载图片,因为当图片尺寸较大时,picasso 会将图片旋转 90 度。
Glide 有使用方法文档:https://github.com/bumptech/glide
Gradle:
根:
repositories {
mavenCentral()
google()
}
应用程序:
dependencies {
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
}
如何在 glide 上设置你的 uri 数据:
Glide.with(mContext)
.load(new File(pictureUri.getPath())) // Uri of the picture
.transform(new CircleTransform(..))
.into(image);
我正在写一个应用程序。我的应用将从图库中 select 照片。我用 Picasso 加载 Image 到 ImageView。
问题是 Picasso 会自动旋转从相机拍摄的任何照片,但不会旋转任何从互联网下载并保存到内部存储器的图像
这是从网上下载的图片:
这是相机拍的照片,Picasso 自动旋转它,我要修复它:
这是我的代码:
picasso
.load(uriPhoto)
.resize(newWidthBitmap.toInt(), newHeightBitmap.toInt())
.centerInside()
//.rotate(90f)
.into(target_image)
首先交叉检查您的相机图像位图是否旋转,因为某些手机(如三星 s4)在从相机拍摄图像时会将图像旋转 90 度。如果图片未旋转,则使用滑行加载图片,因为当图片尺寸较大时,picasso 会将图片旋转 90 度。
Glide 有使用方法文档:https://github.com/bumptech/glide
Gradle:
根:
repositories {
mavenCentral()
google()
}
应用程序:
dependencies {
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
}
如何在 glide 上设置你的 uri 数据:
Glide.with(mContext)
.load(new File(pictureUri.getPath())) // Uri of the picture
.transform(new CircleTransform(..))
.into(image);