It's a bit of a hack, but if you just want to set a directory and not the filename manually, you can do:
HOME=/path/to/directory gnome-screenshot
gnome-screenshot saves in the ~/Pictures folder by default, since that is what XDG_PICTURES_DIR is usually set to in $XDG_CONFIG_HOME/user-dirs.dirs ("$HOME/Pictures"). But if that directory doesn't exist, or XDG_PICTURES_DIR isn't defined, it dumps the screenshot in $HOME. And since:
XDG_CONFIG_HOME is taken to be $HOME/.config if not explicitly set,
- and there's unlikely to be a
.config/user-dirs.dir file in /path/to/directory
this command causes gnome-screenshot to dump the screenshot in /path/to/directory.
Or, less hacky but more complicated, create a directory somewhere (say /path/to/another/dir), with a user-dirs.dir file in it containing:
XDG_PICTURES_DIR="/path/to/dir"
Then you can do:
XDG_CONFIG_DIR=/path/to/another/dir gnome-screenshot
and again the screenshot will end up in /path/to/dir.