Android Question Resize an image

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,
 

KZero

Active Member
Licensed User
try this code to resize the image

you will need to enable "Refliction" Library

B4X:
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
 
Top