2021-09-16 14:42:59 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
###########################
|
|
|
|
#
|
|
|
|
# Centers an image in a white frame.
|
|
|
|
# Used for creating SVG files with a
|
|
|
|
# "natural" offset.
|
|
|
|
#
|
|
|
|
###########################
|
|
|
|
|
2021-08-07 16:15:12 +00:00
|
|
|
WIDTH=404
|
|
|
|
HEIGHT=374
|
|
|
|
|
|
|
|
#40.5
|
|
|
|
#66
|
|
|
|
|
|
|
|
#FWIDTH=323
|
|
|
|
#FHEIGHT=242
|
|
|
|
|
|
|
|
#800x800 white in center of image
|
|
|
|
#convert image.jpg -background white -gravity center -extent 800x800 output.jpg
|
|
|
|
|
|
|
|
convert -size ${WIDTH}x${HEIGHT} xc:#FFFFFF white.png
|
2021-08-10 22:06:57 +00:00
|
|
|
composite -gravity Center "${1}" white.png "${2}"
|
2021-08-07 16:15:12 +00:00
|
|
|
rm white.png
|
|
|
|
|
|
|
|
echo "Centered in white ${1} -> ${2}"
|