I use this script to create square images for Ambiences, and sometimes Imageworks to color the black parts:
in="$1"
out="$2"
#a=2048
# Xperia 10 horiz. res.
a=2520
ax=$(( $a + 300 ))
sizea=${a}x${a}
#sizeax=${ax}x${ax}
sizeax=$sizea
#im_opts="-background rgb(255,0,255) -resize $sizea -gravity center -extent $sizeax"
im_opts="-background rgb(0,0,0) -resize $sizea -gravity center -extent $sizeax"
echo convert $im_opts $in $out
convert $im_opts $in $out