Search code examples
androidimageviewandroid-imageviewblurryandroid-ion

loading image into android imageView with ion returns a blurry result


I'm trying to load an image from filesystem into an imageView with the ion library.

When I'm using the following code:

Ion.with(imageView)
.placeholder(R.drawable.placeholder_image)
.error(R.drawable.error_image)
.load(uri);

it (sometimes) results in a kind of blurry image.

When not using ion like the following the pictures appear sharply:

imageView.setImageBitmap(BitmapFactory.decodeFile(uri.toString()));

Is there a standard compression coming with ion that I can disable?

Strangely not every picture is blurry when using ion, e.g. I have two identical images, only with another name. When I load them into the imageView with ion one is blurry, one is not.

Any help or tips are appreciated!


Solution

  • Ion tries to load the image to fit the bounds of the ImageView. So make sure your ImageView is sized properly in your layout. Alternatively, if you use adjustViewBounds=true to indicate the ImageView is adjusted by the image contents, it won't do that. Or alternatively smartsize(false).