using System;
using System.IO;
namespace BitmapSize
{
class Class1
{
static void Main(string[] args)
{
long bmpWidth = 0;
long bmpHeight = 0;
int bmpPlanes = 0;
int bmpBitCount = 0;
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;
bmpWidth = binRead.ReadInt32();
bmpHeight= binRead.ReadInt32();
bmpPlanes= binRead.ReadInt16();
bmpBitCount = binRead.ReadInt16();
Console.WriteLine("[{0}] {1}x{2} {3}-
bit",cma[1],bmpWidth,bmpHeight,bmpBitCount);
binRead.Close();
myFStream.Close();
}
}
}
}
Post a Comment