code: func DecodeDir(r ReadAtReader, order binary.ByteOrder) (d *Dir, offset int32, err error) {
  	d = new(Dir)
  
  	// get num of tags in ifd
  	var nTags int16
  	err = binary.Read(r, order, &nTags)
  	if err != nil {
  		return nil, 0, errors.New("tiff: failed to read IFD tag count: " + err.Error())
  	}
  
  	// load tags
  	for n := 0; n < int(nTags); n++ {
  		t, err := DecodeTag(r, order)
  		if err != nil {
  			return nil, 0, err
  		}
  		d.Tags = append(d.Tags, t)
  	}
  
  	// get offset to next ifd
  	err = binary.Read(r, order, &offset)
  	if err != nil {
  		return nil, 0, errors.New("tiff: falied to read offset to next IFD: " + err.Error())
  	}
  
  	return d, offset, nil
  }
docs: // DecodeDir parses a tiff-encoded IFD from r and returns a Dir object.  offset
  // is the offset to the next IFD.  The first read from r should be at the first
  // byte of the IFD. ReadAt offsets should generally be relative to the
  // beginning of the tiff structure (not relative to the beginning of the IFD).