Q:

ImageMagick: How to add multiline text superimposed over picture? Text is truncated

Code -
convert -size 2000x1000 xc:none -gravity center \
    -stroke yellow -pointsize 50 -font Courier-BoldOblique -strokewidth 3 -annotate +100+100 caption:'Conflict is the gadfly of thought. It stirs us to observation and memory. It instigates to invention. It shocks us out of sheeplike passivity, and sets us at noting and contriving' \
    -blur 0x25 -level 0%,50% \
    -fill white -stroke none -annotate +100+100 caption:'Conflict is the gadfly of thought. It stirs us to observation and memory. It instigates to invention. It shocks us out of sheeplike passivity, and sets us at noting and contriving' \
    1.jpg  +swap -gravity center -geometry +0-3 \
    -composite  Walpaperquote.jpg

Output : 

My question is : How can i make the complete text appear ? Where are the things going wrong ?
Thanks for your help in advance !!
Have tried many ways but can't figure it out how to set this right !!
And i am very new to ImageMagick !!

A:

The solution here is to include newlines in input text.
There are a few ways to do this:
$'\n'
Use $'...\n...' - by quoting a string with $'...', escape sequences are enabled - \n is a newline. See here for more escape sequences.
caption=$'Conflict is the gadfly of thought.\nIt stirs us to observation and memory.\nIt instigates to invention.\nIt shocks us out of sheeplike passivity, and sets us at noting and contriving'

read -d ''
Use read -d '' to take multiple lines from stdin - EOFmarks the end of input.
read -d '' caption <<EOF
Conflict is the gadfly of thought.
It stirs us to observation and memory.
It instigates to invention.
It shocks us out of sheeplike passivity, and sets us at noting and contriving
EOF

Multi-line Variable
It's actually possible to include a line break between quotes, though I dislike this from a readability point of view.
caption="Conflict is the gadfly of thought.
It stirs us to observation and memory.
It instigates to invention.
It shocks us out of sheeplike passivity, and sets us at noting and contriving"

Usage
This can subsequently be used as an argument to convert:
in_file='1.jpg'
out_file='Walpaperquote.jpg'

convert -size 2000x1000 xc:none -gravity center \
    -stroke yellow -pointsize 50 -font Courier-BoldOblique -strokewidth 3 -annotate +100+100 "caption:${caption}" \
    -blur 0x25 -level 0%,50% \
    -fill white -stroke none -annotate +100+100 "caption:${caption}" \
    "${in_file}"  +swap -gravity center -geometry +0-3 \
    -composite  "${out_file}"

Example output (cropped) - you'll still need to adjust the bounding box's size.

