Android Question picture size (Weigth - Heigth)

Tayfur

Well-Known Member
Licensed User
Longtime User
Hello ;
Use code for image size:

B4X:
Dim  xbmp As Bitmap
xbmp.Initialize(File.DirRootExternal, "962656-B.png")
Pixture_Weigth= xbmp.Width
Pixture_Weigth= xbmp.Width

Picture orjinal size
W=3328
H=2344
picture.png




my code result

W=417
H=295

picture2.png


How can I Learn real size?
 
Last edited:

Tayfur

Well-Known Member
Licensed User
Longtime User
Create a new simple app, containting only the image and that code.

Try it, and if it don't works well, post it

Same code, different result.
How is???????????? I dont understandt it. (Maybe its bug for EREL)

This is my orjinal program.

picture1.jpg



this code is new short program for only dimension cheking.

picture2.png
 
Upvote 0

Mrjoey

Active Member
Licensed User
Longtime User
Try this
B4X:
Sub CreateScaledBitmap(Original As Bitmap, Width As Int, Height As Int) As Bitmap
    Dim r As Reflector
    Dim b As Bitmap
    b = r.RunStaticMethod("android.graphics.Bitmap", "createScaledBitmap", _
            Array As Object(Original, Width, Height, True), _
            Array As String("android.graphics.Bitmap", "java.lang.int", "java.lang.int", "java.lang.boolean"))
    Return b
End Sub
 
Upvote 0

Tayfur

Well-Known Member
Licensed User
Longtime User
Try this
B4X:
Sub CreateScaledBitmap(Original As Bitmap, Width As Int, Height As Int) As Bitmap
    Dim r As Reflector
    Dim b As Bitmap
    b = r.RunStaticMethod("android.graphics.Bitmap", "createScaledBitmap", _
            Array As Object(Original, Width, Height, True), _
            Array As String("android.graphics.Bitmap", "java.lang.int", "java.lang.int", "java.lang.boolean"))
    Return b
End Sub

Hello;
Your code is not run! Please see attachment.
 

Attachments

  • report.png
    report.png
    246.7 KB · Views: 156
Upvote 0

Mrjoey

Active Member
Licensed User
Longtime User
or dont intialize the bitmap
B4X:
dim xbmp as bitmap
xbmp.bitmap =CreateScaledBitmap(LoadBitmap(File.DirAssets, "bmp.png"),100dip,100dip)
 
Upvote 0
Top