aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshmibs <shmibs@gmail.com>2014-07-08 11:28:59 -0700
committershmibs <shmibs@gmail.com>2014-07-08 11:28:59 -0700
commit6e61dc69a46b676a32fb8c85fdc33223f0fbce4e (patch)
tree97c99e3d4805cb319c2270b9009ab0bbcd3cf62b
parent556f82efe07a363fc8d380e259df62968322afb0 (diff)
downloaddotfiles-6e61dc69a46b676a32fb8c85fdc33223f0fbce4e.tar.gz
imagemagick backdrop shadowing
this isn't going too well so far, but it almost sort of works. it'd be nice to be able to just draw the shadow on top directly rather than using a pre-drawn shadow image, but imagemagick makes no sense
-rw-r--r--.zshrc36
1 files changed, 35 insertions, 1 deletions
diff --git a/.zshrc b/.zshrc
index a0df374..4e14600 100644
--- a/.zshrc
+++ b/.zshrc
@@ -133,11 +133,14 @@ ssh-scrot() {
date=$(date +'%Y-%m-%d')
- ssh shmibbles.me "mkdir -p http/img/scrot/$date"
+ folder="http/img/scrot"
+ ssh shmibbles.me "mkdir -p $folder/$date"
if [[ "${?#0}" != "" ]]; then
return 1
fi
+
+ ssh shmibbles.me "rm $folder/current 2>/dev/null; ln -s $folder/$date $folder/current"
for i in {3..1}; do
echo -n "$i "
@@ -162,3 +165,34 @@ ssh-scrot() {
rm /tmp/$name.png /tmp/${name}_small.png
}
+
+# yay imagemagick
+update-backdrops() {
+ resolution=( ${(s:x:)$(xrandr | grep "*+" | cut -d ' ' -f 4)} )
+ IFS=$'\n'
+ for f in $(find ~/backdrops/(*.png|*.jpg)); do
+
+ base="$(basename $f)"
+ geometry=( ${(s: :)$(identify -format "%w %h" $f)} )
+ if [[ $(calc "(${geometry[0]}/${geometry[1]}) > 1.7778" | \
+ tr -d '\t') != "0" ]]; then
+ scale="x${resolution[1]}"
+ crop="${resolution[0]}x"
+ else
+ scale="${resolution[0]}x"
+ crop="x${resolution[1]}"
+ fi
+
+ if [[ ! -f "$HOME/backdrops/shadowed/$base" ]]; then
+ echo "$base..."
+ convert \
+ -page +0+0 "$f" \
+ -scale $scale \
+ -crop $crop \
+ -page +0+0 "$HOME/backdrops/dropshadow/shadow.png" \
+ -composite \
+ "$HOME/backdrops/shadowed/$base"
+ fi
+
+ done
+}