androidimageviewpicasso

Picasso showing image in a Landscape mode


Using Picasso library to download images from server and to place in a ImageView, but every time it's showing images in a Landscape mode only, even image originally in Portrait mode.

I have some images in Landscape mode and some in Portrait mode but while downloading and showing into ImageView getting in Landscape mode only !

Usage of Picasso:

        Picasso.with(MainActivity.this)
        .load(imageURL) // web image url
        .fit().centerInside()
        .transform(transformation)
        .error(R.drawable.ic_launcher)
        .placeholder(R.drawable.ic_launcher)
        .into(viewHolder.imageView , new Callback() {
            ....
            }
        });

Solution

  • To rotate image using Picasso, all you need to do is set degrees to rotate in picasso's load() method, as below

    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(viewHolder.imageView , new Callback() {
                ....
                }
            });