Created
January 18, 2021 17:20
-
-
Save Wikinaut/cfb8b425b4779a8c1ea2b2a62d417643 to your computer and use it in GitHub Desktop.
Breaking-News image generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Imagegenerator for "Breaking News" | |
# Init 20210112 | |
if [[ $# -ne 3 ]] ; then | |
echo "Usage:" | |
echo "breaking-news \"headline-text\" \yellow-ribbon-text\" imagefile" | |
exit | |
fi | |
nowhour=$(date +"%H:%M") | |
now=$(date +"%Y%m%d-%H%M%S") | |
font="Dosis-Bold" | |
text="$(echo $1 | sed -e "s/ /_/g" -)" | |
outfile="${now}-breakingnews_${text}-${3%.*}.png" | |
ffmpeg -i "$3" -filter_complex '[0:v]scale=ih*16/9:-1,boxblur=luma_radius=min(h\,w)/20:luma_power=1:chroma_radius=min(cw\,ch)/20:chroma_power=1[bg];[bg][0:v]overlay=(W-w)/2:(H-h)/2,crop=h=iw*9/16' -f image2pipe - | \ | |
convert - -resize 1280x720 -background black -gravity center -extent 1280x720 \ | |
-gravity center -font $font \ | |
-fill "#d72c23" -draw "rectangle 14,430 450,470" \ | |
-fill "#821a18" -draw "rectangle 14,470 450,510" \ | |
-fill white -background "#00000000" -size 450x80 caption:"BREAKING NEWS" -geometry -410+110 \ | |
-composite \ | |
-fill black -background "#dedede80" -size 1266x110 caption:"$1" -geometry +7+206 \ | |
-composite \ | |
-fill black -background "#feeb1a80" -pointsize 36 -size 1165x60 caption:"$2" -geometry +57+291 \ | |
-composite \ | |
-fill white -background black -size 101x60 -pointsize 28 caption:"$nowhour" -geometry -575+291 \ | |
-composite \ | |
-fill white -background "#c2150f" -size 105x60 -pointsize 50 caption:"LIVE" -geometry -574-290 \ | |
-composite \ | |
"${outfile}" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment