Reputation: 743
I writting a application. My app will select photo from gallery. I use Picasso to load Image to ImageView.
Problem is Picasso auto rotate any photo captured from camera, but not rotate any image downloaded and saved to internal storage from internet
This is image download from internet:
This is photo captured from camera, Picasso auto rotate it, i want fix it:
This is my code:
picasso
.load(uriPhoto)
.resize(newWidthBitmap.toInt(), newHeightBitmap.toInt())
.centerInside()
//.rotate(90f)
.into(target_image)
Upvotes: 4
Views: 2501
Reputation: 845
First cross check that your camera image bitmap is rotated or not because some phones like samsung s4 rotates image 90 degree when taking image from camera. If image not rotated then use glide for loading image because picasso rotates image to 90 degree when it's size is bigger.
For Glide there is documentation how to use : https://github.com/bumptech/glide
Gradle:
root:
repositories {
mavenCentral()
google()
}
app:
dependencies {
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
}
How to set your uri data on glide:
Glide.with(mContext)
.load(new File(pictureUri.getPath())) // Uri of the picture
.transform(new CircleTransform(..))
.into(image);
Upvotes: 4