我可以在终端中使用什么命令,等效于PrtSc(打印屏幕)按钮?
我正在运行Ubuntu GNOME。
gnome-screenshot是统一获取屏幕截图的默认工具。
我可以在终端中使用什么命令,等效于PrtSc(打印屏幕)按钮?
我正在运行Ubuntu GNOME。
gnome-screenshot是统一获取屏幕截图的默认工具。
Answers:
您可以使用ImageMagick软件包中提供的导入工具(如果您的系统上尚不可用,则需要安装此工具)。
在外壳中运行以下命令:
import screenshot.png并通过单击鼠标左键并拖动来选择要捕获的窗口或选择一个区域。
import实际上是一个非常强大的命令,可以用多种方式来捕获屏幕。例如,要捕获整个屏幕并经过一段时间延迟并调整其大小,请使用以下命令:
import -window root -resize 400x300 -delay 200 screenshot.png要查看import命令可用的所有选项,请访问ImageMagick的网站。
从终端获取屏幕截图的另一种方法是使用scrot
要安装 scrot类型:
sudo apt-get install scrot
要在Linux上使用scrot类型的终端截屏:
scrot MyScreenshot.png
一些其他选项scrot在这里:
scrot -b -d 5 '%Y:%m:%d:%H:%M:%S.png' -e 'mv $f ~/Desktop/'
在这个例子中
.png在这种情况下,'%Y:%m:%d:%H:%M:%S.png'将使用基于当前日期和时间的名称和指定格式保存屏幕截图。-e 'mv $f ~/Desktop/' 告诉scrot将屏幕截图保存到桌面 import以纯黑色呈现KDE Desktop Effects的透明窗口边框/发光效果。而且scrot根本不想参与管道,在从Xinerama设置中裁剪所需的屏幕时,我用它来避免不必要的中间文件。我用xwd,而不是和使用的ImageMagick convert的转换XWD -format以PNG,做裁剪。(另请参见下面的回答)
在此找到此选项,并且还列出了其他选项。
通过按+ + 打开终端并键入CtrlAltT
gnome-screenshot
使用gnome-screenshot -d xx延迟操作。
将屏幕截图操作延迟10秒
gnome-screenshot -d 10
要么
sleep 10;gnome-screenshot
gnome-screenshot --help将给您很多选择。
gnome-screenshot --interactive
您可以使用快门程序从终端上截屏。在终端中运行以下命令以安装快门,
sudo add-apt-repository ppa:shutter/ppa
sudo apt-get update
sudo apt-get install shutter
要截取活动窗口的屏幕截图,
shutter -a -o shot.png -e
要截取整个显示的屏幕截图,
shutter -f -o shot.png -e
截取的屏幕快照存储在主目录中。
有关更多选项的运行shutter --help命令,
Usage:
shutter [options]
Options:
Example 1
shutter -a -p=myprofile --min_at_startup
Example 2
shutter -s=100,100,300,300 -e
Example 3
shutter --window=.*firefox.*
Example 4
shutter --web=http://shutter-project.org/ -e
Capture Mode Options:
-s, --select=[X,Y,WIDTH,HEIGHT]
Capture an area of the screen. Providing X,Y,WIDTH,HEIGHT is
optional.
-f, --full
Capture the entire screen.
-w, --window=[NAME_PATTERN]
Select a window to capture. Providing a NAME_PATTERN (Perl-style
regex) ist optional.
-a, --active
Capture the current active window.
--section
Capture a section. You will be able to select any child window
by moving the mouse over it.
-m, --menu
Capture a menu.
-t, --tooltip
Capture a tooltip.
--web=[URL]
Capture a webpage. Providing an URL ist optional.
-r, --redo
Redo last screenshot.
Settings Options:
-p, --profile=NAME
Load a specific profile on startup.
-o, --output=FILENAME
Specify a filename to save the screenshot to (overwrites any
profile-related setting).
Supported image formats: You can save to any popular image
format (e.g. jpeg, png, gif, bmp). Additionally it is possible
to save to pdf, ps or svg.
Please note: There are several wildcards available, like
%Y = year
%m = month
%d = day
%T = time
$w = width
$h = height
$name = multi-purpose (e.g. window title)
$nb_name = like $name but without blanks in resulting strings
$profile = name of current profile
$R = random char (e.g. $RRRR = ag4r)
%NN = counter
The string is interpretted by strftime. See "man strftime" for
more examples.
As an example: shutter -f -e -o './%y-%m-%d_$w_$h.png' would
create a file named '11-10-28_1280_800.png' in the current
directory.
Application Options:
-h, --help
Prints a brief help message and exits.
-v, --version
Prints version information.
-d, --debug
Prints a lot of debugging information to STDOUT.
--clear_cache
Clears cache, e.g. installed plugins, at startup.
--min_at_startup
Starts Shutter minimized to tray.
--disable_systray
Disables systray icon.
-e, --exit_after_capture
Exit after the first capture has been made. This is useful when
using Shutter in scripts.
我尝试使用ImageMagick, import但使用KDE Desktop Effects时对我不起作用。ImageMagick的 import输出透明窗口边框为黑色,而不是正确组合前景Alpha和背景。
我也尝试过使用X11 xwd和NetPBM, xwdtopnm但这对我也不起作用,因为我有一个Xinerama设置,所以NetPBM xwdtopnm无法正确处理多屏输出xwd。
但是将X11 xwd与ImageMagick 结合起来convert对我来说效果很好:
xwd -silent -root | convert xwd:- screenshot.png
或者,如果您像我一样具有Dual-FullHD Xinerama设置,并且只想要第一个屏幕:
xwd -silent -root | convert xwd:- -crop 1920x1080+0+0 test.png
仅对于第二个屏幕:
xwd -silent -root | convert xwd:- -crop 1920x1080+1920+0 +repage test.png
xwd ... | convert xwd:- ...。至少我安装了IM 6.9.6-2的Debian Strech才需要安装
如果要从登录终端(使用Ctrl+ Alt+ 打开的终端)截取屏幕截图,F1可以使用该程序fbgrab。
您可以通过键入安装它sudo apt-get install fbcat。
然后截取您的登录终端的屏幕快照,输入您的登录终端:
$ sudo fbgrab my_screenshot
my_screenshot保存在当前目录下。
my_screenshot?怎么看?
我正在使用ubuntu 13.10,我刚刚编写了一个脚本,可能会有所帮助。我看到此问题已得到解答,但我的解决方案不需要其他安装。
#!/bin/bash
curDate=$(date)
imgExtension=".png"
imgName=$curDate$imgExtension
imgDirectory="/path/to/desires/save/directory/"
imgSavePath=$imgDirectory$imgName
gnome-screenshot --file="$imgSavePath"
此代码将保存屏幕截图,而不会弹出对话框。它使用文件名的当前时间来避免任何重复的文件名问题。