PBDR.COM

About   -   Contact   -   Purchase   -   Search   -   What's New

 
 
Getting a Bitmaps Width and Height
This tip shows how to extract the width and height from a bitmap source file on disk.
// Width and height of a picture inside a BMP file
int job
blob b
ulong width, height

job = FileOpen( "filename.bmp", StreamMode!, Read! )
FileRead( job, b )
width  = Long( Integer( BlobMid( b, 19, 2 ) ), &
   Integer( BlobMid( b, 21, 2) ) )
height = Long( Integer( BlobMid( b, 23, 2 ) ), &
   Integer( BlobMid( b, 25, 2) ) )
FileClose( job )

 

Top of Page

Legal Notice

Ken Howe 2011