I would like to extract the header info from an image file. For example I would like to search for the key "LINES" and return "2240" as string. And should I use open("r") or open("b") since im only interested in the header.
Header:
BANDS = 1
BAND_STORAGE_TYPE = BAND_SEQUENTIAL
BAND_NAME = "N/A"
LINES = 2240
LINE_SAMPLES = 3840
SAMPLE_TYPE = UNSIGNED_INTEGER
SAMPLE_BITS = 8
END
I wonder if this is the right direction.
file = "D:\\IMG\\mc03.img"
f = open(file,"r").readline()
for line in f:
if line.find("BAND"):
s = line.split()
h_band = s[2]
if line.find("LINES"):
s = line.split()
h_lines = s[2]
Thanks for any suggestions.