从 gnome-screenshot 命令行,您如何预定义区域?

Tim*_*Tim 7 gnome command-line screenshot

所以 gnome-screenshot 有以下选项:

tim@Hairy14:~$ gnome-screenshot --help
Usage:
  gnome-screenshot [OPTION…] Take a picture of the screen

Help Options:
  -h, --help                     Show help options
  --help-all                     Show all help options
  --help-gtk                     Show GTK+ Options

Application Options:
  -c, --clipboard                Send the grab directly to the clipboard
  -w, --window                   Grab a window instead of the entire screen
  -a, --area                     Grab an area of the screen instead of the entire screen
  -b, --include-border           Include the window border with the screenshot
  -B, --remove-border            Remove the window border from the screenshot
  -p, --include-pointer          Include the pointer with the screenshot
  -d, --delay=seconds            Take screenshot after specified delay [in seconds]
  -e, --border-effect=effect     Effect to add to the border (shadow, border, vintage or none)
  -i, --interactive              Interactively set options
  -f, --file=filename            Save screenshot directly to this file
  --version                      Print version information and exit
  --display=DISPLAY              X display to use
Run Code Online (Sandbox Code Playgroud)

我感兴趣的一个是-a

如果它运行它,会发生以下情况,我可以单击并拖动屏幕上的任意位置,它会保存我选择的图像。

我有捷径Alt+ Shift+4就此成立。

但我想要的是一个预定义的区域,沿着这条线:

gnome-screenshot -a 400x500+100x100
Run Code Online (Sandbox Code Playgroud)

(即 400 向下,500 英寸和 100x100 区域)。

这可能吗,是否有执行此操作的命令?

注意:我可以convert -crop像这样使用图像裁剪工具:

convert -crop 100x100+50+50 Pictures/Screenshot.png Pictures/Screenshot-cropped.png
Run Code Online (Sandbox Code Playgroud)

但如果它是内置的,我会喜欢它,因为裁剪一个完整的打印屏幕会使它变得模糊......

Nyk*_*kin 11

看起来没有这样的选项,但您可以使用从命令行控制鼠标xdotool,因此您可以尝试使用它:

(gnome-screenshot -a &); sleep 0.1 && xdotool mousemove 100 100 mousedown 1 mousemove 500 500 mouseup 1 
Run Code Online (Sandbox Code Playgroud)

我使用(cmd &)语法让命令在后台运行(仅使用 && 在这里不起作用,因为gnome-screenshot等待输入)并进行小延迟(尝试尝试使用睡眠值)以确保鼠标在准备好之前不会移动。然后我使用mousemove x y,mousedown 1mouseup 1命令来模拟抓取一个区域。

您还应该查看更适合importImageMagick获取屏幕截图的工具:

import -window root ~/Pictures/img.png -crop 100x100+1100+1100
Run Code Online (Sandbox Code Playgroud)