Skip to content

Instantly share code, notes, and snippets.

@badvision
Created January 25, 2024 18:47
Show Gist options
  • Save badvision/d0b1d4d3f18903479603cba73eafe675 to your computer and use it in GitHub Desktop.
Save badvision/d0b1d4d3f18903479603cba73eafe675 to your computer and use it in GitHub Desktop.
Create random images
#!/bin/bash
for (( i=1; i<=500; i++ ))
do
# Generate a random filename
filename="random_image_${i}.png"
# Use ImageMagick to create a random 100x100 pixel image
color1=$(shuf -e $(convert -list color | grep srgb | cut -d' ' -f1) | head -1 | tr [:upper:] [:lower:])
color2=$(shuf -e $(convert -list color | grep srgb | cut -d' ' -f1) | head -1 | tr [:upper:] [:lower:])
convert -size 100x100 gradient:${color1}-${color2} "${filename}"
echo "Generated ${filename} using ${color1}-${color2}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment