bash: create black rectangles / squares using imagemagick
Posted by rolf on Thursday, 20 August 2015
To create rectangles of a solid color with bash, following script comes in handy. Save it in a file, e.g. createBlackRect.sh and run it with
bash /path/to/script/createBlackRect.sh
Here the script
#!/bin/bash
# ============================================================================================
# creates several black square .png images
# ============================================================================================
for (( i=128; ${i}<=800; i++)); do
for ((j=128; ${j}<=800; j++)); do
convert -size ${i}x${j} xc:#000000 BlackSquare_${i}x${j}.png
done
echo Created File ${i} of 800
done#000000 is the color black, to have another color, e.g. red use #990000. For more color information, see imagemagick color names.
Add new comment