Read Bitmap Size by using BinaryReader
using System;
using System.IO;
class Class1 {
static void Main(string[] args) {
string[] cma = Environment.GetCommandLineArgs();
if (cma.GetUpperBound(0) >= 1) {
FileStream myFStream = new FileStream(cma[1], FileMode.Open, FileAccess.Read);
BinaryReader binRead = new BinaryReader(myFStream);
binRead.BaseStream.Position = 0x12;
Console.WriteLine(binRead.ReadInt32());
Console.WriteLine(binRead.ReadInt32());
Console.WriteLine(binRead.ReadInt16());
Console.WriteLine(binRead.ReadInt16());
binRead.Close();
myFStream.Close();
}
}
}
Related examples in the same category