public int Open(Stream stream) { // close previous decoding Close(); this.imageInfo = ReadHeader(stream); this.stream = stream; this.dataPosition = stream.Seek(0, SeekOrigin.Current); return imageInfo.TotalFrames; }