add text feature, but very q&n - bad code quality - i clean up later, promise!
This commit is contained in:
parent
bb5010789f
commit
7332285c93
2 changed files with 46 additions and 3 deletions
|
@ -15,12 +15,16 @@ pixelfloot was built during the 37c3. in its actual state, its just a mess. I ho
|
||||||
- set the position : `W=420 H=420 ./pixelfloot_bash.sh floot images/lucky-cat.jpg shake`
|
- set the position : `W=420 H=420 ./pixelfloot_bash.sh floot images/lucky-cat.jpg shake`
|
||||||
- move image with your cursor (needs `xdotool`): `./pixelfloot_bash.sh floot images/lucky-cat.jpg cursor`
|
- move image with your cursor (needs `xdotool`): `./pixelfloot_bash.sh floot images/lucky-cat.jpg cursor`
|
||||||
- Use a color as "alpha" (remove background): `ALPHACOLOR=FF00FF ./pixelfloot_bash.sh floot images/cursor.ppm cursor`
|
- Use a color as "alpha" (remove background): `ALPHACOLOR=FF00FF ./pixelfloot_bash.sh floot images/cursor.ppm cursor`
|
||||||
|
- write text: `TEXT="pixelflut makes a lot of fun! :)" ./pixelfloot_bash.sh floot text`
|
||||||
|
- set the size of the Textbox and the textcolor: `COLOR=FF00FF SIZE=240 TEXT="colors, yeah!" ./pixelfloot_bash.sh floot text`
|
||||||
|
- you can also use ALPHACOLOR here, or set your: `ALPHACOLOR=000000 TEXT="colors, yeah!" ./pixelfloot_bash.sh floot text`
|
||||||
|
- define your own background color: `BGCOLOR=0000FF SIZE=240 TEXT="colors, yeah!" ./pixelfloot_bash.sh floot text`
|
||||||
- increase No of concurrent connections: `FLOOTFORKS=8 ./pixelfloot_bash.sh floot images/lucky-cat.jpg`
|
- increase No of concurrent connections: `FLOOTFORKS=8 ./pixelfloot_bash.sh floot images/lucky-cat.jpg`
|
||||||
- specify IP and PORT: `IPFLOOT=127.0.0.1 FLOOTPORT=1337 ./pixelfloot_bash.sh floot images/lucky-cat.jpg`
|
- specify IP and PORT: `IPFLOOT=127.0.0.1 FLOOTPORT=1337 ./pixelfloot_bash.sh floot images/lucky-cat.jpg`
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ ./pixelfloot_bash.sh help
|
$ ./pixelfloot_bash.sh help
|
||||||
./pixelfloot_bash.sh [floot|convertimg] [FILENAME|fill] ([MODE])
|
./pixelfloot_bash.sh [floot|convertimg] [FILENAME|fill|text] ([MODE])
|
||||||
MODE: static (env $H and $W for position)
|
MODE: static (env $H and $W for position)
|
||||||
chaos (env $H and $W for position range)
|
chaos (env $H and $W for position range)
|
||||||
shake (env $H and $W for position range)
|
shake (env $H and $W for position range)
|
||||||
|
@ -28,7 +32,9 @@ MODE: static (env $H and $W for position)
|
||||||
|
|
||||||
available env vars to configure:
|
available env vars to configure:
|
||||||
RESIZE(int), ALPHACOLOR(hex), FLOOTFORKS(int), H(int), W(int)
|
RESIZE(int), ALPHACOLOR(hex), FLOOTFORKS(int), H(int), W(int)
|
||||||
|
SIZE(int), TEXT(string), TEXTSIZE(int), BGCOLOR(hex), COLOR(hex)
|
||||||
IPFLOOT(string), FLOOTPORT(string), USECACHE(bool)
|
IPFLOOT(string), FLOOTPORT(string), USECACHE(bool)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Running on my Ryzen 4700G with [wellenbrecher](https://github.com/bits0rcerer/wellenbrecher) 1280x720 and three workers,
|
Running on my Ryzen 4700G with [wellenbrecher](https://github.com/bits0rcerer/wellenbrecher) 1280x720 and three workers,
|
||||||
|
|
|
@ -216,6 +216,10 @@ convertimg() {
|
||||||
done < <(convert $IMGFILE $RESIZE txt: | tail -n +2 | awk '{print $1 $3}' | sed -e 's/\,/ /' -e 's/\:/ /' -e 's/\#//')
|
done < <(convert $IMGFILE $RESIZE txt: | tail -n +2 | awk '{print $1 $3}' | sed -e 's/\,/ /' -e 's/\:/ /' -e 's/\#//')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#~ generate_text() {
|
||||||
|
|
||||||
|
#~ }
|
||||||
|
|
||||||
sx=0
|
sx=0
|
||||||
sy=0
|
sy=0
|
||||||
shuf_xy() {
|
shuf_xy() {
|
||||||
|
@ -296,7 +300,39 @@ floot() {
|
||||||
do
|
do
|
||||||
LOL[$i]="$LOL_org"
|
LOL[$i]="$LOL_org"
|
||||||
done
|
done
|
||||||
else
|
elif [ "$FNAME" == "text" ]
|
||||||
|
then
|
||||||
|
test -z "$TEXT" && TEXT="pixelfloot"
|
||||||
|
test -z "$TEXTSIZE" && TEXTSIZE=42
|
||||||
|
test -z "$COLOR" && COLOR="000000"
|
||||||
|
test -z "$BGCOLOR" && BGCOLOR="FFFFFF"
|
||||||
|
|
||||||
|
if [ -n "$SIZE" ]
|
||||||
|
then
|
||||||
|
SIZE="-size $SIZE"
|
||||||
|
|
||||||
|
fi
|
||||||
|
#set -x
|
||||||
|
#convert -fill lightgreen -background white -pointsize 40 caption:"KARTTUR" -quality 72 DstImage.png
|
||||||
|
message "generating text, size $TEXTSIZE for ${YELLOW}$FLOOTFORKS${ENDCOLOR} workers"
|
||||||
|
LOL_org="$(convert ${SIZE} +antialias -depth 8 -fill \#${COLOR} -background \#${BGCOLOR} -pointsize ${TEXTSIZE} caption:"${TEXT}" -quality 72 txt: | tail -n +2 | awk '{print $1 $3}' | sed -e 's/\,/ /' -e 's/\:/ /' -e 's/\#//' -e 's/^/PX /')"
|
||||||
|
#echo "$LOL_org"
|
||||||
|
#read
|
||||||
|
for i in $(seq 1 $FLOOTFORKS)
|
||||||
|
do
|
||||||
|
#LOL[$i]="$(echo "$LOL_org" | shuf )"
|
||||||
|
if [ -z "$ALPHACOLOR" ]
|
||||||
|
then
|
||||||
|
LOL[$i]="$(echo "$LOL_org" | shuf)"
|
||||||
|
#LOL[$i]="$(convertimg | shuf)"
|
||||||
|
else
|
||||||
|
LOL[$i]="$(echo "$LOL_org" | grep -v $ALPHACOLOR | shuf)"
|
||||||
|
#LOL[$i]="$(convertimg | grep -v $ALPHACOLOR | shuf)"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
else
|
||||||
# generate a tmp file, as i have trouble atm to figure out
|
# generate a tmp file, as i have trouble atm to figure out
|
||||||
# why free space get lost when i generate the pixlist directly
|
# why free space get lost when i generate the pixlist directly
|
||||||
# in ram
|
# in ram
|
||||||
|
@ -391,7 +427,7 @@ case $1 in
|
||||||
floot
|
floot
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "$0 [floot|convertimg] [FILENAME|fill] ([MODE])"
|
echo "$0 [floot|convertimg] [FILENAME|fill|text] ([MODE])"
|
||||||
echo "MODE: static (env \$H and \$W for position)"
|
echo "MODE: static (env \$H and \$W for position)"
|
||||||
echo " chaos (env \$H and \$W for position range)"
|
echo " chaos (env \$H and \$W for position range)"
|
||||||
echo " shake (env \$H and \$W for position range)"
|
echo " shake (env \$H and \$W for position range)"
|
||||||
|
@ -399,6 +435,7 @@ case $1 in
|
||||||
echo ""
|
echo ""
|
||||||
echo "available env vars to configure:"
|
echo "available env vars to configure:"
|
||||||
echo "RESIZE(int), ALPHACOLOR(hex), FLOOTFORKS(int), H(int), W(int)"
|
echo "RESIZE(int), ALPHACOLOR(hex), FLOOTFORKS(int), H(int), W(int)"
|
||||||
|
echo "SIZE(int), TEXT(string), TEXTSIZE(int), BGCOLOR(hex), COLOR(hex)"
|
||||||
echo "IPFLOOT(string), FLOOTPORT(string), USECACHE(bool)"
|
echo "IPFLOOT(string), FLOOTPORT(string), USECACHE(bool)"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in a new issue