[Keith Vetter] : 2006-09-06 ---- proc bmpsize {fname} { set fin [open $fname r] fconfigure $fin -translation binary set sig [read $fin 2] if {$sig ne "BM"} { close $fin error "$fname is not a BMP file" } seek $fin 18 ;# Past 4 integer header fields binary scan [read $fin 4] i width binary scan [read $fin 4] i height close $fin return [list $width $height] } ---- [AMG]: The width and height are stored at offset 18, not 14. At 14 is the DIB header size, which is normally 40 bytes [http://en.wikipedia.org/wiki/BMP_file_format#DIB_Header_.28Bitmap_Information_Header.29]. I updated the above code accordingly. **See also** * [BMP Dump] * [Reading GIF image dimensions] * [Reading PNG image dimensions] * [Reading JPEG image dimensions] * [Reading image type and dimensions] <> Graphics | File