Moves binaries for use with gnu stow

This commit is contained in:
Jonathan Hodgson 2019-07-30 14:06:10 +01:00
parent f528ba793c
commit 4fd9f4809b
89 changed files with 0 additions and 0 deletions

52
bin/.bin/images/createGif Executable file
View file

@ -0,0 +1,52 @@
#!/bin/bash
# Creates a gif using a list of files from stdin
tmpdir="/tmp/sxiv-gif/"
rm -rf "$tmpdir"
mkdir -p "$tmpdir"
framerate="prompt"
format="gif"
extension=""
while [[ $# -gt 0 ]]; do
case "$1" in
"-r"|"--framerate")
framerate="$2"
shift
shift
;;
"--mp4")
format="mp4"
shift
;;
esac
done
if [[ "$framerate" == "prompt" ]]; then
framerate=$(echo -e "0.25\n0.5\n0.75\n1\n2\n5\n10" | rofi -dmenu -p Timeout)
fi
i=1
while read file; do
extension="${file##*.}"
number=$(printf "%03d" $i)
echo "$number"
cp "$file" "${tmpdir}file${number}.${extension}"
i=$((i+1))
done
notify-send "Generating $format from images"
case "$format" in
"mp4")
# Not entierly sure what all of these mean but they make it work in most browsers
ffmpeg -f image2 -framerate "$framerate" -i "${tmpdir}file%03d.${extension}" -pix_fmt yuv420p -vcodec libx264 -y -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" "${tmpdir}out.${format}"
;;
*)
ffmpeg -f image2 -framerate "$framerate" -i "${tmpdir}file%03d.${extension}" "${tmpdir}out.${format}"
esac
mv "${tmpdir}out.${format}" "$HOME/Desktop/"
notify-send "Done" "File in $HOME/Desktop/out.${format}"

View file

@ -0,0 +1,27 @@
#!/usr/bin/env bash
# Purpose: batch image resizer
# absolute path to image folder
FOLDER="$PWD"
# max height
WIDTH=${1:-"999999"}
# max width
HEIGHT=${2:-"999999"}
echo "Width: $WIDTH";
echo "Height: $HEIGHT";
#resize png or jpg to either height or width, keeps proportions using imagemagick
#find ${PWD} -iname '*.jpg' -o -iname '*.png' -exec echo convert \{} -verbose -resize $WIDTHx$HEIGHT\> \{}.new.jpg \;
find ${PWD} \( -iname "*.jpg" -o -iname "*.png" \) -exec convert {} -verbose -resize "$WIDTH"x"$HEIGHT" \{}.new \;
#resize png to either height or width, keeps proportions using imagemagick
#find ${FOLDER} -iname '*.png' -exec convert \{} -verbose -resize $WIDTHx$HEIGHT\> \{} \;
#resize jpg only to either height or width, keeps proportions using imagemagick
#find ${FOLDER} -iname '*.jpg' -exec convert \{} -verbose -resize $WIDTHx$HEIGHT\> \{} \;
# alternative
#mogrify -path ${FOLDER} -resize ${WIDTH}x${HEIGHT}% *.png -verbose

22
bin/.bin/images/lanPortImages Executable file
View file

@ -0,0 +1,22 @@
#!/usr/bin/env bash
mkdir "portraits"
mkdir "landscapes"
for f in ./*.jpg; do
WIDTH=$(identify -format "%w" "$f")> /dev/null
HEIGHT=$(identify -format "%h" "$f")> /dev/null
echo "Width: $WIDTH"
echo "Height: $HEIGHT"
echo ""
if [[ "$HEIGHT" > "$WIDTH" ]]; then
mv "$f" portraits/
else
mv "$f" landscapes/
fi
#if file "$f" 2>&1 | awk '/w =/{w=$5+0; h=$7+0; if (h>w) exit; else exit 1}'
#then
# mv "$f" portraits/
#else
# mv "$f" landscapes/
#fi
done