yoshi24
yoshi24

Reputation: 3177

bitmap.createScaledBitmap() not resizing image retrieved from a url?

I am trying to resize a bitmap using this...

try {

       bitmap = BitmapFactory.decodeStream((InputStream)new URL(url).getContent());
       Bitmap.createScaledBitmap(bitmap, 1000, 100, true);

    } catch (MalformedURLException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }

Its not working though. The images stay the same size.

Is this the right way to resize the bitmap?

Or is there another way?

Upvotes: 0

Views: 5322

Answers (1)

chocolat
chocolat

Reputation: 36

Did you try bitmap=createScaledBitmap(..) and check? That method returns a new bitmap. http://developer.android.com/reference/android/graphics/Bitmap.html#createScaledBitmap%28android.graphics.Bitmap,%20int,%20int,%20boolean%29

Upvotes: 2

Related Questions