1

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!

c7n
  • 1,131
  • 16
  • 29
  • 1
    Ion tries to load the image to fit the bounds of the imageview. So make sure your imageview is sized properly. Alternatively, if you use adjustViewBounds=true, it won't do that. or smartsize(false) – koush Sep 02 '15 at 09:48
  • works great, that was what I was looking for! thank you very much for the explanation – c7n Sep 02 '15 at 09:53
  • 2
    Cool I added the answer so you can accept it. – koush Sep 02 '15 at 17:25

2 Answers2

4

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).

koush
  • 2,972
  • 28
  • 31
-1

Try this,

Ion.with(context)
.load(url)
.withBitmap()
.placeholder(R.drawable.placeholder_image)
.error(R.drawable.error_image)
.intoImageView(imageView);
Prokash Sarkar
  • 11,723
  • 1
  • 37
  • 50
  • 1
    this only seems to be the _long_ way of building an imageView request accoridng to the [documentation](https://github.com/koush/ion#load-an-image-into-an-imageview) and leads to the exact same result – c7n Sep 02 '15 at 07:10