Created
May 7, 2010 18:28
-
-
Save ninehills/393821 to your computer and use it in GitHub Desktop.
简单的屏幕截图脚本
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#屏幕截图,截取选择区域到 SCRDIR 目录 | |
NOW=`date '+%Y-%m-%d-%H-%M-%S'` | |
if [ -z $2 ]; then | |
FNAME=screenshot-${NOW} | |
else | |
FNAME="[$2]-${NOW}" | |
fi | |
EXT=png | |
SCRDIR=${HOME}/tmp/snap/ | |
if [ ! -d "${SCRDIR}" ]; then | |
mkdir -p "${SCRDIR}" | |
fi | |
if [ -z $1 ]; then | |
cmd="import -frame ${SCRDIR}${FNAME}.${EXT}" | |
else | |
cmd="import -frame -window $1 ${SCRDIR}${FNAME}.${EXT}" | |
fi | |
eval $cmd | |
echo ${SCRDIR}${FNAME}.${EXT} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment