From 063ed86ee36b8d1331b7d5c6819638ec946690c4 Mon Sep 17 00:00:00 2001 From: Marcus Date: Fri, 5 Jan 2024 02:15:06 +0100 Subject: [PATCH] support for a colored border in text --- README.md | 4 ++-- pixelfloot_bash.sh | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 016f63e..89bd6a6 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ convertimg: converts an image to a command list file in /tmp FILENAME: path to any picture imagemagick can handle fill: create a filled area with (env COLOR, W (width), H (height), X, Y) -text: create a textbox (env TEXT, FONTSIZE, SIZE, COLOR, BGCOLOR) +text: create a textbox (env TEXT, FONTSIZE, SIZE, COLOR, BGCOLOR, BORDERCOLOR) MODE: static (env X and Y for position) chaos (env X_MAX and Y_MAX for position range) @@ -46,7 +46,7 @@ MODE: static (env X and Y for position) available env vars to configure: IPFLOOT(string), FLOOTPORT(int), USECACHE(bool), FLOOTFORKS(int) SIZE(int), TEXT(string), FONTSIZE(int), BGCOLOR(hex), COLOR(hex) -X(int), Y(int), X_MAX(int), Y_MAX(int), H(int), W(int) +BORDERCOLOR(hex), X(int), Y(int), X_MAX(int), Y_MAX(int), H(int), W(int) RESIZE(int), ALPHACOLOR(hex), BOUNCESTEP(int) ``` diff --git a/pixelfloot_bash.sh b/pixelfloot_bash.sh index a919c54..f139a42 100755 --- a/pixelfloot_bash.sh +++ b/pixelfloot_bash.sh @@ -353,6 +353,7 @@ floot() { ;; ""|text) + set -x test -z "$TEXT" && TEXT="$0" test -z "$FONTSIZE" && FONTSIZE=42 test -z "$COLOR" && COLOR="000000" @@ -363,9 +364,17 @@ floot() { SIZE="-size $SIZE" fi + + if [ -n "$BORDERCOLOR" ] + then + BORDER="-bordercolor #${BORDERCOLOR} -border 2x2" + else + BORDER="" + fi #convert -fill lightgreen -background white -pointsize 40 caption:"KARTTUR" -quality 72 DstImage.png message "generating text, size $FONTSIZE for ${YELLOW}$FLOOTFORKS${ENDCOLOR} workers" - LOL_org="$(convert ${SIZE} +antialias -depth 8 -fill \#${COLOR} -background \#${BGCOLOR} -pointsize ${FONTSIZE} caption:"${TEXT}" -quality 72 txt: | tail -n +2 | awk '{print $1 $3}' | sed -e 's/\,/ /' -e 's/\:/ /' -e 's/\#//' -e 's/^/PX /')" + set +x + LOL_org="$(convert ${SIZE} ${BORDER} +antialias -depth 8 -fill \#${COLOR} -background \#${BGCOLOR} -pointsize ${FONTSIZE} caption:"${TEXT}" -quality 72 txt: | tail -n +2 | awk '{print $1 $3}' | sed -e 's/\,/ /' -e 's/\:/ /' -e 's/\#//' -e 's/^/PX /')" loadLOL ;; @@ -488,7 +497,7 @@ case $1 in echo "" echo "FILENAME: path to any picture imagemagick can handle" echo "fill: create a filled area with (env COLOR, W (width), H (height), X, Y)" - echo "text: create a textbox (env TEXT, FONTSIZE, SIZE, COLOR, BGCOLOR)" + echo "text: create a textbox (env TEXT, FONTSIZE, SIZE, COLOR, BGCOLOR, BORDERCOLOR)" echo "" echo "MODE: static (env X and Y for position)" echo " chaos (env X_MAX and Y_MAX for position range)" @@ -499,7 +508,7 @@ case $1 in echo "available env vars to configure:" echo "IPFLOOT(string), FLOOTPORT(int), USECACHE(bool), FLOOTFORKS(int)" echo "SIZE(int), TEXT(string), FONTSIZE(int), BGCOLOR(hex), COLOR(hex)" - echo "X(int), Y(int), X_MAX(int), Y_MAX(int), H(int), W(int)" + echo "BORDERCOLOR(hex), X(int), Y(int), X_MAX(int), Y_MAX(int), H(int), W(int)" echo "RESIZE(int), ALPHACOLOR(hex), BOUNCESTEP(int)" exit 1