Images are not clear - Picasso Android
I am using Picasso to load images from url and input ImageView. Images are rectangle but my ImageViews are squares. So I need to use some trimming because I have spaces at the top and bottom.
Without cropping, the image becomes clear:
Picasso.with(context)
.load(left.get(pos).getImageName())
.into(ivFrontPageLeftImage);
To fit inside and crop, I use:
Picasso.with(context)
.load(left.get(pos)
.getImageName())
.fit().centerInside()
.into(ivFrontPageLeftImage);
But as you can see, the image is not clear, it is blurry. So how can I fit an image inside a square (ImageView). Also, should the image be clear and not blurry?
I download this image, crop it to 300 x 300 (to be square, I cut left and right) and load it, I use this new image to set the ImageView:
Picasso.with(context)
.load("http://oi62.tinypic.com/29y61p3.jpg")
.fit().centerCrop()
.into(ivFrontPageLeftImage);
As you can see, the image is clear and not blurry. How can I do this programmatically? Is this possible with Picasso, or do I need another library for this?
source to share
I can't comment on Lee's answer as I don't have enough reputation. But his answer was correct as I had the same problem. You can also set it on an object ImageView
by doing the following:
imageView = (ImageView) view.findViewById(R.id.img); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
source to share