support for BORDERCOLOR in text and images

This commit is contained in:
Marcus 2024-01-05 02:28:38 +01:00
parent 063ed86ee3
commit e01cb272cb
2 changed files with 13 additions and 10 deletions

View file

@ -33,7 +33,8 @@ convertimg: converts an image to a command list file in /tmp
to use it, start 'USECACHE=true ./pixelfloot_bash.sh floot [FILENAME]', where FILENAME to use it, start 'USECACHE=true ./pixelfloot_bash.sh floot [FILENAME]', where FILENAME
is the original image file. is the original image file.
FILENAME: path to any picture imagemagick can handle FILENAME: path to any picture imagemagick can handle (env X, Y, RESIZE,
BORDERCOLOR, ALPHACOLOR)
fill: create a filled area with (env COLOR, W (width), H (height), X, Y) fill: create a filled area with (env COLOR, W (width), H (height), X, Y)
text: create a textbox (env TEXT, FONTSIZE, SIZE, COLOR, BGCOLOR, BORDERCOLOR) text: create a textbox (env TEXT, FONTSIZE, SIZE, COLOR, BGCOLOR, BORDERCOLOR)

View file

@ -36,6 +36,7 @@ declare -a PIXMAP
declare -a LOL declare -a LOL
declare -a LOLPID declare -a LOLPID
# colors for colored output 8) # colors for colored output 8)
RED="\e[31m" RED="\e[31m"
GREEN="\e[32m" GREEN="\e[32m"
@ -221,7 +222,7 @@ convertimg() {
fi fi
convert $IMGFILE $RESIZE txt: | tail -n +2 | awk '{print $1 $3}' | sed -e 's/\,/ /' -e 's/\:/ /' -e 's/\#//' -e 's/^/PX /' convert $IMGFILE $BORDER $RESIZE txt: | tail -n +2 | awk '{print $1 $3}' | sed -e 's/\,/ /' -e 's/\:/ /' -e 's/\#//' -e 's/^/PX /'
} }
#~ generate_text() { #~ generate_text() {
@ -334,7 +335,12 @@ loadLOL() {
} }
floot() { floot() {
if [ -n "$BORDERCOLOR" ]
then
BORDER="-bordercolor #${BORDERCOLOR} -border 2x2"
else
BORDER=""
fi
case $FNAME in case $FNAME in
# small stupid animation, two alternating images # small stupid animation, two alternating images
@ -365,12 +371,7 @@ floot() {
fi 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 #convert -fill lightgreen -background white -pointsize 40 caption:"KARTTUR" -quality 72 DstImage.png
message "generating text, size $FONTSIZE for ${YELLOW}$FLOOTFORKS${ENDCOLOR} workers" message "generating text, size $FONTSIZE for ${YELLOW}$FLOOTFORKS${ENDCOLOR} workers"
set +x set +x
@ -495,7 +496,8 @@ case $1 in
echo " to use it, start 'USECACHE=true $0 floot [FILENAME]', where FILENAME" echo " to use it, start 'USECACHE=true $0 floot [FILENAME]', where FILENAME"
echo " is the original image file." echo " is the original image file."
echo "" echo ""
echo "FILENAME: path to any picture imagemagick can handle" echo "FILENAME: path to any picture imagemagick can handle (env X, Y, RESIZE, "
echo " BORDERCOLOR, ALPHACOLOR)"
echo "fill: create a filled area with (env COLOR, W (width), H (height), X, Y)" 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, BORDERCOLOR)" echo "text: create a textbox (env TEXT, FONTSIZE, SIZE, COLOR, BGCOLOR, BORDERCOLOR)"
echo "" echo ""