Get Dimesions of Graphic

Bill Norris

Active Member
Licensed User
Longtime User
Is possible to get the pixel dimensions of a graphic file at runtime, so as to be able to dynamically resize a "frame" around the graphic based on its dimensions?
 

Ohanian

Active Member
Licensed User
Longtime User
B4X:
Dim bEx As BitmapExtended
Dim iHeight As Int
Dim iWidth As Int

iHeight = bEx.getHeight(LoadBitmap(File.DirAssets, "sample.png"))
iWidth = bEx.getWidth(LoadBitmap(File.DirAssets, "sample.png"))
 
Upvote 0

Jost aus Soest

Active Member
Licensed User
Longtime User
BTW:
Is there already a ready-to-use possibility to get the pixel dimensions without loading the whole file?
Sometimes the files are simply huge...
 
Upvote 0
Top