Android Question Resize Image by Inches

amykonio

Active Member
Licensed User
Longtime User
I believe you question is to generic.
What information do you have about the image you want to resize?

Andreas.
 
Upvote 0

BarryW

Active Member
Licensed User
Longtime User
Code to get the (more) accurate x and y pixels per inch:
B4X:
Dim r As Reflector
    r.Target = r.GetContext
    r.Target = r.RunMethod("getResources")
    r.Target = r.RunMethod("getDisplayMetrics")
    Dim xdpi As Double = r.GetField("xdpi")
    Dim ydpi As Double = r.GetField("ydpi")

How to apply this on bitmap.resize
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
to convert between pixels and inches, you need to know how many pixels = 1 inch. in the old days, it was 96. now, it depends on screen density. screen density varies with device, so you have to query the device. if you know how many inches you're looking for, you can multiply by the ratio (px per inch) to determine the size of the bitmap in pixels. good luck and godspeed!
 
Upvote 0
Top