Files
dfi-docs/utils/make_gif_examples.bash
Aaron Fiore 845d826f29 Migrate (and update) docs from 'docker-finance' repo to 'dfi-docs' repo
- Moves all documentation to this repository
- Updates markdown to reflect latest impl
- Updates assets to reflect latest impl
  * Assets are also now more self-documenting
  * Adds utility script to create gif examples
2025-10-29 12:01:02 -07:00

46 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# docker-finance | modern accounting for the power-user
#
# Copyright (C) 2025 Aaron Fiore (Founder, Evergreen Crypto LLC)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
make_gif_examples()
{
local -r _path="$(dirname "$(realpath -s $0)")/../assets/examples"
if [ ! -d "${_path}"/png ]; then
echo "FATAL: example path not found" >&2
return 1
fi
hash gawk || return $?
hash magick || return $?
ls "${_path}"/png \
| gawk '{print $(NF-1)}' FS='_' \
| sort -u \
| while read _file; do
magick "${_path}"/png/*"${_file}"* \
-gravity center \
-crop 2:1 \
+repage \
-resize 400x400 \
-set delay $((RANDOM % (350 - 250 + 1) + 250)) \
"${_path}"/gif/"${_file}".gif
done
}
make_gif_examples