2009-12-08

Slitaz -- scrot

How to take screenshots with Scrot

scrot -d 5 -q 95 -t 30 screenshot.jpeg -b -s && gwenview screenshot.jpeg

If you wish to specify a window or part of a screen (use your mouse to draw out a selected area) then just append -s thus:

scrot desktop.png -s

and then use your cursor to draw out the area for your screenshot.

scrot '%Y-%m-%d_$wx$h_scrot.png' -e 'mv $f ~/images/shots/'

root@slitaz:~# cat /usr/share/applications/scrot.desktop
[Desktop Entry]
Encoding=UTF-8
Name=Scrot screenshot
Name[fr]=Capture d'écran
Exec=scrot
Icon=/usr/share/icons/Tango/16x16/devices/camera-video.png
Type=Application
Terminal=false
Categories=Application;Graphics;
root@slitaz:~#

root@slitaz:~# cat /usr/bin/shot
#!/bin/sh

/usr/bin/scrot -d 6 `date +%Y%m%d%H%M%S`.jpg -s

root@slitaz:~# cat /usr/bin/shots
#!/bin/sh

/usr/bin/scrot -b -d 1 `date +%Y%m%d%H%M%S`.jpg
root@slitaz:~#
root@slitaz:~# date +%Y%m%d%H%M%S
20091208192942
root@slitaz:~# date
Tue Dec 8 19:29:47 UTC 2009

root@slitaz:~# scrot --help
Usage : scrot [OPTIONS]... [FILE]
Where FILE is the target file for the screenshot.
If FILE is not specified, a date-stamped file will be dropped in the
current directory.
See man scrot for more details
-h, --help display this help and exit
-v, --version output version information and exit
-b, --border When selecting a window, grab wm border too
-c, --count show a countdown before taking the shot
-d, --delay NUM wait NUM seconds before taking a shot
-e, --exec APP run APP on the resulting screenshot
-q, --quality NUM Image quality (1-100) high value means
high size, low compression. Default: 75.
For lossless compression formats, like png,
low quality means high compression.
-m, --multidisp For multiple heads, grab shot from each
and join them together.
-s, --select interactively choose a window or rectnagle
with the mouse
-t, --thumb NUM generate thumbnail too. NUM is the percentage
of the original size for the thumbnail to be,
or the geometry in percent, e.g. 50x60 or 80x20.

SPECIAL STRINGS
Both the --exec and filename parameters can take format specifiers
that are expanded by scrot when encountered.
There are two types of format specifier. Characters preceded by a '%'
are interpretted by strftime(2).
See man strftime for examples.
These options may be used to refer to the current date and time.
The second kind are internal to scrot and are prefixed by '$'
The following specifiers are recognised:
$f image path/filename (ignored when used in the filename)
$m thumbnail path/filename
$n image name (ignored when used in the filename)
$s image size (bytes) (ignored when used in the filename)
$p image pixel size
$w image width
$h image height
$t image format
$$ prints a literal '$'
\n prints a newline (ignored when used in the filename)
Example:
scrot '%Y-%m-%d_$wx$h_scrot.png' -e 'mv $f ~/images/shots/'
Creates a file called something like 2000-10-30_2560x1024_scrot.png
and moves it to your images directory.

This program is free software see the file COPYING for licensing info.
Copyright Tom Gilbert 2000
Email bugs to
root@slitaz:~#

Extract From
http://aaron0117.blogspot.com/2008/08/strftime.html

時間格式化函數 strftime

strftime() 函數將時間格式化
......
函數strftime()的操作有些類似於sprintf():識別以百分號(%)開始的格式命令集合,格式化輸出結果放在一個字符串中。格式化命令說明串 strDest中各種日期和時間信息的確切表示方法。格式串中的其他字符原樣放進串中。格式命令列在下面,它們是區分大小寫的。
%a 星期幾的簡寫
%A 星期幾的全稱
%b 月分的簡寫
%B 月份的全稱
%c 標準的日期的時間串
%C 年份的後兩位數字
%d 十進製表示的每月的第幾天
%D 月/天/年
%e 在兩字符域中,十進製表示的每月的第幾天
%F 年-月-日
%g 年份的後兩位數字,使用基於周的年
%G 年分,使用基於周的年
%h 簡寫的月份名
%H 24小時制的小時
%I 12小時制的小時
%j 十進製表示的每年的第幾天
%m 十進製表示的月份
%M 十時製表示的分鐘數
%n 新行符
%p 本地的AM或PM的等價顯示
%r 12小時的時間
%R 顯示小時和分鐘:hh:mm
%S 十進制的秒數
%t 水平製表符
%T 顯示時分秒:hh:mm:ss
%u 每週的第幾天,星期一為第一天 (值從0到6,星期一為0)
%U 第年的第幾周,把星期日做為第一天(值從0到53)
%V 每年的第幾周,使用基於周的年
%w 十進製表示的星期幾(值從0到6,星期天為0)
%W 每年的第幾周,把星期一做為第一天(值從0到53)
%x 標準的日期串
%X 標準的時間串
%y 不帶世紀的十進制年份(值從0到99)
%Y 帶世紀部分的十制年份
%z,%Z 時區名稱,如果不能得到時區名稱則返回空字符。
%% 百分號

.......