Android Question Resize an image

Discussion in 'Android Questions' started by ttsolution, Feb 9, 2015.

  1. ttsolution

    ttsolution Member Licensed User

    Dear all,

    How can we resize an image taking from phone camera to a smaller size ?
    for example: after taking the image, if the image size > 1MB then I want to resize to 1MB only.

    many thanks for any help

    Jonh,
     
  2. KZero

    KZero Active Member Licensed User

    try this code to resize the image

    you will need to enable "Refliction" Library

    Code:
    Sub CreateScaledBitmap(Original As Bitmap, Width As Int, Height As Int) As Bitmap
        
    Dim r As Reflector
        
    Dim Filter As Boolean =False
        
    Dim b As Bitmap
        b = r.RunStaticMethod(
    "android.graphics.Bitmap""createScaledBitmap", _
            
    Array As Object(Original, Width, Height, Filter), _
            
    Array As String("android.graphics.Bitmap""java.lang.int""java.lang.int""java.lang.boolean"))
        
    Return b
    End Sub
     
  3. ttsolution

    ttsolution Member Licensed User

    It's works.

    Thanks Kzero
     
Loading...
  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