public class Main
{
public static void main(String[] args)
{
BinaryReader myFile;
myFile = new BinaryReader(File.Open("1.pcx", FileMode.Open));
byte mark = myFile.ReadByte();
if (mark != 10)
{
System.out.println("Not a PCX file!");
}
else
{
myFile.BaseStream.Seek(4, SeekOrigin.Begin);
short xMin = myFile.ReadInt16();
short yMin = myFile.ReadInt16();
short xMax = myFile.ReadInt16();
short yMax = myFile.ReadInt16();
System.out.println("Width: " + (xMax - xMin + 1));
System.out.println("Height: " + (yMax - yMin + 1));
}
myFile.Close();
}
}