This tip shows how to extract the width and height from a bitmap source file on disk.

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 )

 

posted @ 2010-10-23 08:25  lenya  阅读(151)  评论(0编辑  收藏  举报