~scripts
55 itemsDownload ./*

55 itemsDownload ./*

..
dzen2
tiling
vosh
4cdl
4trips
alarm
ambient
ana-wall.sh
battery-monitor
brightness.sh
checkit
cleverbot.py
clock
color-gen
colors-hex
colorscheme.sh
compton
dailywall
dmenu
ffthumb
grid
gridmacro
gridmacro.kde
help
importw
indexer
install-all.sh
install-twily.sh
installng
keep-on
mp3ogg
orage
pipes
pipes.x
pipewire_bt.sh
ports
rain
randwall
rotate.sh
scan.sh
screen-dim
screencast
screencast2
scrot
scrotw
search
skull
slocker
starwars
streamit
sumnum
tty-colorize
usrmount
ytp
ytplay


scriptsimportw
2 602•  8 years ago•  DownloadRawClose
8 years ago•  2 602

{}
#!/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.info 2013 - 2024
twily at twily dot info



2 033 093 visits
... ^ v