CreateSquareFlyer.sh 778 B

12345678910111213141516171819202122
  1. #!/bin/bash
  2. # A script to create a square flyer using ImageMagick
  3. filename="flyer_${1}.png"
  4. filenameresized="resized_${filename}"
  5. filenamesquare="square_${filename}"
  6. filenamejpg="square_flyer_${1}.jpg"
  7. filenamewebp="square_flyer_${1}.webp"
  8. echo "Going into directory $1"
  9. cd $1
  10. cp ../flyer_inkscape_background.png .
  11. convert -background green -gravity center flyer_inkscape_background.png -extent 1200x1200 background.png
  12. convert -resize 1000x1000 $filename $filenameresized
  13. convert -composite -gravity center background.png $filenameresized $filenamesquare
  14. convert $filenamesquare $filenamejpg
  15. convert $filenamesquare $filenamewebp
  16. # cleanup
  17. rm $filenameresized
  18. rm background.png
  19. rm flyer_inkscape_background.png
  20. echo "Created $filenamesquare , $filenamejpg and $filenamewebp "