Android Question Change bitmap size

Discussion in 'Android Questions' started by Carles Escudé, Jul 3, 2015.

  1. Carles Escudé

    Carles Escudé Member Licensed User


    I have a source bitmap sized 300x200 and I want to load it in another bitmap sized 150x100

    Ofcourse I want to resize it. Not cutted

    How can I do it?

  2. Carles Escudé

    Carles Escudé Member Licensed User

    Don't know if there is a better solution, but I did it! :)

    Sub changeImageSize(bmp As Bitmap, destWidth As Int, destHeight As Int) As Bitmap
    Private imv As ImageView
    Private cvs As Canvas
    Dim pnl As Panel
    Dim rSrc As Rect
    Dim rDest As Rect
    00, bmp.Width, bmp.Height)
    00, destWidth*2, destHeight/2)
        cvs.DrawBitmap(bmp, rSrc, rDest)
    Return imv.Bitmap
    End Sub
  3. sorex

    sorex Expert Licensed User

    it depends. if you use an imageview of 150x100 and use the fill gravity it will resize it for you from 300x200 to 150x100
  4. Carles Escudé

    Carles Escudé Member Licensed User

    No. I do not load it in a image view. I am loading it in a xnGridCol.

    I have tried to set the gravity of the column to "Fill" but it don't change anyting.

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice