private void readHeader() throws IOException, InvalidDataTypeException {
		byte[] bytes = new byte[6];  // MAGIC bytes
		inputStream.read(bytes);
		if (!Arrays.equals(bytes, GifDataType.MAGIC_87) &&
			!Arrays.equals(bytes, GifDataType.MAGIC_89)) {
			throw new InvalidDataTypeException("Invalid GIF Data");
		}
		inputStream.readShort();			// width
		inputStream.readShort();			// height

		int flags = inputStream.read();
		boolean globalColorTableFlag = (flags & 0x80) != 0;
		int globalColorTableSize = 2 << (flags & 7);
		inputStream.read();		// background color index
		inputStream.read();		// pixel aspect ratio

		if (globalColorTableFlag) {
			inputStream.skipBytes(3 * globalColorTableSize);
		}
	}
Class for determining the size of a GIF image. It loads just enough of the GIF information to 
follow the data block links and read the bytes until the terminator is hit.  The amount of
bytes read indicate the number of bytes the GIF data type is consume.
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/GIFResource.java