Rotating bitmap from URL using Picasso library - android

I need to display images using Picasso library, keeping the original orientation.
I'm taking pictures using Camera or from Gallery, and then upload multiple images to server using Volley.
The problem is when images are loaded, they are rotated, i.e. orientation is wrong.
How can I rotate images in both portrait or landscape mode loaded from server?
Picasso.with(getApplicationContext()).load("http://:www..." + url).into(imageView);
I tried to get exif orientation from images on server using PHP exif_read_info, but Orientation is not specified.

To rotate by 90 degree use.
Picasso
.with(context)
.load("http://:www..." + url)
.rotate(90f)
.into(imageView);

Related

Android - Picasso image orientation changed

In my android application, we are using Picasso plugin to display the file in to the imageview. Please refer the below code.
val pf= File(photo!!.thumbnailPath)
Picasso.get()
.load(pf)
.into(imageView)
I am using latest Picasso plugin and in this code, if we select landscape image from gallery then the image will display fine on the ImageView. But if we select the portrait images then it will automatically change the orientation while displaying it on ImageView.
I knew this is the known bug in Picasso plugin and I tried lot of other possibilities and couldn't able to fix it. Can anybody have any idea about how to display all images in proper way in the ImageView without any orientation.
In above diagram car image as landscape and flower image as portrait mode. I need to fix that flower image (portrait mode) should display properly as it is in gallery.
Thanks
AK

Picasso displays in wrong orientation

Picasso.with(mContext).load(lPreviewData.getImage()).into(holder.lPreviewIV);
This is how I am rendering the image url to ImageView. Unfortunately when i render an image it was showing in landscape mode but the actual image is in portrait.
This is a problem with exif rotation handling in Picasso. You should either rotate the image in code or fix the source image to have the correct orientation without using exif rotation.
I should also mention that this problem only affects images retrieved via url.

Android: Rotate bitmap once or use EXIF orientation to rotate imageview

I am building an app that relies on showing quite a few bitmap images taken from the camera. I want all of the images to show with a 90 degree (portrait) orientation, and I know how I can do this with the EXIF information provided with each image. Would it be a better idea for me to rotate the bitmap of an image to fit my needs right after it is taken and then send it to my server, or should I send the image to my server without rotating it and then whenever I pull it down, use the EXIF rotation provided with the image to rotate the image view I am displaying it in? I need a solution that is memory efficient and fast. Thanks.
Since bitmap is just a matrix with the some data in every cell it should have the same weight (in terms of mb) if it's portrait or landscape, in case you need the images to be in a 90 deg. tilt ALL the time I would probabley do it before sending it to the server since (by my logic) you would probabley pull it ALOT more than upload it (which will only happen once..) so saving it on the way you are going to display it will basically have no effect on it's weight consumption HOWEVER since you are going to display it alot (again, by my logic since you keep it in a server) saving it alreay rotated will probabley save some other clients the hassle from doing that themselves..

which is best? Creating bitmap from imageview or downloading the file

we are using an app for setting wallpaper in android device, for that we are doing below steps
1) we have set of images and URLs
2) We are fetching the URL on an Imageview
so now we have to set the wallpaper, for that we need the image file, which is the best way to do it?
1) Download the file directly from URL and store it in a local storage and use it as wallpaper.
or
2) Create a bitmap from the Imageview and use it as wallpaper.
Doing the second option will reduce any quality of the image we using?
First option how to we can do it?
We have fetch the images successfully inside the application.
Always prefer to cache your image downloads so that you don't have to repeat the task. Using libraries like Picasso or Glide reduces a lot of effort is handling your images while at the same time optimizing your code.
Additionally it's best to use the original image as wallpaper rather than consuming the image view because if you have set any scale type's on your image view then your image will be cropped.
Picasso allows for hassle-free image loading in your application—often in one line of code!
Picasso.with(context).load("http://i.imgur.com/DvpvklR.png").into(imageView);

Load large images from URL using Picasso

I load about images from about 30 different URLs into a ListView using Picasso. Some of the images are small, some of them are quite large (>3MB).
When I think of reducing the images using the Picasso method .resize(width, height) I dont know the original ration of the image I downloaded.
How could I possible know the dimensions of the downloaded (original) image in order to set the "new dimensions" or the resized image in the correct/appropriate relation?
Thanks

Categories

Resources