Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- image_in=$1
- if [ -z "$1" ]; then image_in=~/downloads/Nicos_Anastasiades_at_EPP_HQ.jpg; fi
- top_text=$2
- if [ -z "$2" ]; then
- top_text="CYPRUS'S PRESIDENT DESCRIBES HOW\nHIS COUNTRY SURVIVED"
- top_text="${top_text}\nTHE 2013 FINANCIAL CRISIS"
- fi
- bottom_text=$3
- if [ -z "$3" ]; then
- bottom_text="WE SEIZED ALL FUNDS\nIN EXCESS OF €100,000\n"
- bottom_text="${bottom_text}FROM ALL BANK ACCOUNTS-\n"
- bottom_text="${bottom_text}THE OPPOSITE OF WHAT AMERICA DOES"
- fi
- image_out=$4
- if [ -z "$4" ]; then
- image_out=/tmp/image_out.jpg
- fi
- # the following sets max dimension to 640
- convert -resize 640x640 $image_in /tmp/image_in.jpg
- width=$(identify -format '%w' /tmp/image_in.jpg)
- height=$(identify -format '%h' /tmp/image_in.jpg)
- lineheight=$(echo "$height * .05" | bc) # pixels = 1/20 height
- halfline=$(echo "$lineheight / 2" | bc)
- margin=$(echo "$lineheight * .3" | bc)
- pointsize=$(echo "$lineheight * .75" | bc) # points = pixels * .75
- pagepoints=$(echo "$pointsize * .75" | bc) # pagename pointsize
- copyright=$(echo "$pointsize * .40" | bc) # copyright pointsize
- convert \
- -geometry $width \
- -font Impact-Regular \
- -background none -fill white -stroke black -strokewidth 1 \
- -pointsize $pointsize -gravity center \
- label:"$top_text" /tmp/top_text.gif
- convert \
- -geometry $width \
- -font Impact-Regular \
- -background none -fill white -stroke black -strokewidth 1 \
- -pointsize $pointsize -gravity center \
- label:"\"$bottom_text\"" /tmp/bottom_text.gif
- offset=$(echo $(identify -format %h /tmp/bottom_text.gif) + $halfline | bc)
- convert \
- -font Impact-Regular \
- -background none -fill gray57 -stroke gray13 -strokewidth 1 \
- -pointsize $pagepoints -gravity west \
- label:"FB.com/USACutup" /tmp/pagename.gif
- convert \
- -font Impact-Regular \
- -background none -fill gray57 -stroke gray13 -strokewidth 1 \
- -pointsize $copyright -gravity west \
- label:"jc.unternet.net" /tmp/copyright.gif
- composite -geometry +0+$margin -gravity north /tmp/top_text.gif \
- /tmp/image_in.jpg \
- $image_out
- composite -geometry +0+$margin -gravity south /tmp/bottom_text.gif \
- $image_out $image_out
- composite -geometry +$margin+$offset -gravity southwest /tmp/pagename.gif \
- $image_out $image_out
- composite -geometry +1+1 -gravity southeast /tmp/copyright.gif \
- $image_out $image_out
- echo Netmeme was written to $image_out. >&2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement