made real real nice
This commit is contained in:
parent
64cafa579a
commit
f7fada27b2
2 changed files with 9 additions and 5 deletions
BIN
example.jpg
Normal file
BIN
example.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 110 KiB |
14
main.sh
14
main.sh
|
@ -1,30 +1,34 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
set -e
|
set -e
|
||||||
|
export LC_ALL='C.UTF8'
|
||||||
|
|
||||||
help_text() {
|
help_text() {
|
||||||
printf "
|
printf "
|
||||||
-t path to pango formated text file
|
-t path to pango formated text file
|
||||||
how to format: https://usage.imagemagick.org/text/#pango
|
how to format: https://usage.imagemagick.org/text/#pango
|
||||||
as an environment variable IMAGE_TEXT not with path but the text itself
|
or as an environment variable IMAGE_TEXT not with path but the text itself
|
||||||
if -t is set the environment variable will be ignored
|
if -t is set the environment variable will be ignored
|
||||||
|
|
||||||
-p is a path to write the jpg to
|
-p is a path to write the file to. Format is determined by file ending.
|
||||||
as an environment variable PICTURE_PATH
|
or as an environment variable PICTURE_PATH
|
||||||
if -p is set the environment variable will be ignored
|
if -p is set the environment variable will be ignored
|
||||||
"
|
"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
export LC_ALL='C.UTF8'
|
# directory of the script itself
|
||||||
SCRIPT_DIR="$(cd -P -- "$(dirname -- "$(command -v -- "$0")")" && pwd -P)"
|
SCRIPT_DIR="$(cd -P -- "$(dirname -- "$(command -v -- "$0")")" && pwd -P)"
|
||||||
export SCRIPT_DIR
|
export SCRIPT_DIR
|
||||||
|
|
||||||
P_PATH="$SCRIPT_DIR/label.jpg"
|
# set defaults
|
||||||
|
P_PATH="$SCRIPT_DIR/example.jpg"
|
||||||
I_TEXT="$(cat "$SCRIPT_DIR"/text.pango.example 2>/dev/null || echo 'example text')"
|
I_TEXT="$(cat "$SCRIPT_DIR"/text.pango.example 2>/dev/null || echo 'example text')"
|
||||||
|
|
||||||
|
# read from environment variables
|
||||||
P_PATH="${PICTURE_PATH:-$P_PATH}"
|
P_PATH="${PICTURE_PATH:-$P_PATH}"
|
||||||
I_TEXT="${IMAGE_TEXT:-$I_TEXT}"
|
I_TEXT="${IMAGE_TEXT:-$I_TEXT}"
|
||||||
|
|
||||||
|
# options, they override environment variables
|
||||||
while getopts "p:t:" opt
|
while getopts "p:t:" opt
|
||||||
do
|
do
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
|
|
Loading…
Add table
Reference in a new issue