2

I'm using the Ignition class RemoteImageView to asynchronously download and show images. RemoteImageView is a subclass of ImageView.

I'm downloading 600x600 images and showing them at various sizes... 260x260, 100x100, etc. I notice the image seems fuzzy, less crisp, with artifacts in it.

I don't know much about image rendering, but I notice when I look at the same images in Google Chrome and try zooming out in the browser, it will momentarily have that fuzzy look to it, and then the lines will straighten, the image becoming less blurry and crisp once more--so I'm guessing there's some kind of rendering effect using to show images that I'm not doing with my ImageView.

The images come off a server; I cannot change those original images or have different sizes sent to me.

What else can I do--hopefully something that doesn't add a lot of inefficiency, as sometimes I need to show dozens of these small images on the screen at once in a ListView?

Chad Schultz
  • 7,770
  • 6
  • 57
  • 96

1 Answers1

2

Try using android:scaleType="centerCrop"

You'll have to set hardcoded dp dimension on the width and height of your ImageView to get the desired effect this way, but I'm basically using this solution. Well, not really. But if you want to specify the dimensions of the resultant scaled (and cropped) image, you do.

http://developer.android.com/reference/android/widget/ImageView.ScaleType.html

Thomas Dignan
  • 7,052
  • 3
  • 40
  • 48
  • Well, that's great if I want to show a small, unscaled portion of the image. I need to show the entire image--scaled down to the desired size. – Chad Schultz Dec 21 '12 at 00:08
  • @ChadSchultz What scaletype are you using now? – Thomas Dignan Dec 21 '12 at 00:24
  • @ChadSchultz BTW the docs specifically say that centerCrop performs scaling: "Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equal to or larger than the corresponding dimension of the view (minus padding)." -- it just crops as necessary to preserve the aspect ratio – Thomas Dignan Dec 21 '12 at 00:26
  • My mistake--you're right, I was using centerInside when I should have been using centerCrop. However, since all the images are square, it doesn't actually make a difference... and the fuzziness is still there. – Chad Schultz Dec 21 '12 at 00:35
  • 1
    @ChadSchultz http://stackoverflow.com/questions/4821488/bad-image-quality-after-resizing-scaling-bitmap --- you might have to take scaling into your own hands. Second answer looks promising – Thomas Dignan Dec 21 '12 at 02:32
  • Thanks for the link, Tom! It will be a bit more challenging since I'm using a library and am not directly accessing the bitmaps, but I'll see what I can do, thanks. – Chad Schultz Dec 26 '12 at 18:35