code: func (remote *RemoteDebugger) SaveScreenshot(filename string, perm os.FileMode, quality int, fromSurface bool) error {
  	var format string
  	ext := filepath.Ext(filename)
  	switch ext {
  	case ".jpg":
  		format = "jpeg"
  	case ".png":
  		format = "png"
  	default:
  		return errors.New("Image format not supported")
  	}
  	rawScreenshot, err := remote.CaptureScreenshot(format, quality, fromSurface)
  	if err != nil {
  		return err
  	}
  	return ioutil.WriteFile(filename, rawScreenshot, perm)
  }
docs: // SaveScreenshot takes a screenshot and saves it to a file.