~scripts
40 itemsDownload ./*


..
dzen2
tiling
vosh
4cdl
4trips
alarm
ambient
battery-monitor
checkit
cleverbot.py
clock
color-gen
colors-hex
compton
dailywall
dmenu
importw
indexer
keep-on
mp3ogg
orage
pipes
pipes.x
rain
randwall
screen-dim
screencast
screencast2
scrot
scrotw
search
skull
slocker
starwars
streamit
sumnum
tty-colorize
usrmount
ytp
ytplay


scriptsimportw
2 years agoDownloadRawClose


#!/bin/bash
#
# Profile:     http://www.ugra.ch/iso-color-profiles.phtml
#
# Author:      Twily                               2014
# Description: Capture a window with a margin around it
# Requires:    imagemagic, xwininfo, ISOcoated_v2_300_eci.icc
# Usage:       $ sh ./importw filename.png
#

M=`expr 24 + 0`    # Margin (+ 0 for border)
D=0                # Decoration (0 = none)

if [ -z $1 ]; then set -- "importw.png"; fi

echo -e "\nimportw: Please select the window you would like to\n" \
            "        capture by clicking the mouse in that window.\n"

unset X Y W H
eval $(xwininfo | 
    sed -n -e "s/^ \+Absolute upper-left X: \+\([0-9]\+\).*/X=\1/p" \
           -e "s/^ \+Absolute upper-left Y: \+\([0-9]\+\).*/Y=\1/p" \
           -e "s/^ \+Width: \+\([0-9]\+\).*/W=\1/p" \
           -e "s/^ \+Height: \+\([0-9]\+\).*/H=\1/p" )

W=`expr $W + $M \* 2`
H=`expr $H + $M \* 2 + $D`
X=`expr $X - $M`
Y=`expr $Y - $M - $D`

import -window root -crop $W'x'$H+$X+$Y ~/importw.tmp.png || exit 1
convert ~/importw.tmp.png -profile ~/.icc/ISOcoated_v2_300_eci.icc ~/$1 &>/dev/null || exit 1

rm ~/importw.tmp.png

echo -e "Window captured and saved to \"\e[1;32m~/$1\e[0m\"."
exit 0


Top
twily at openmailbox dot org
©twily.info 2013 - 2017



744 043 visits
... ^ v