Skip to content

Instantly share code, notes, and snippets.

@jonhassall
Created February 15, 2025 21:42
Show Gist options
  • Save jonhassall/69b9f0472935262e9488b4cdb8cc8b48 to your computer and use it in GitHub Desktop.
Save jonhassall/69b9f0472935262e9488b4cdb8cc8b48 to your computer and use it in GitHub Desktop.
Generate 100 labelled test images
#!/bin/bash
mkdir -p test_images
for i in $(seq 1 500); do
# Generate a random noise background
convert -size 3000x2250 xc:gray \
-evaluate Gaussian-noise 5 -blur 0x10 \
test_images/bg_${i}.png
# Create drop shadow text
convert -background none -fill black -pointsize 300 \
label:"TEST $i" -blur 0x15 test_images/shadow_${i}.png
# Create main text
convert -background none -fill white -pointsize 300 \
label:"TEST $i" test_images/text_${i}.png
# Merge images together (background -> shadow -> text)
convert test_images/bg_${i}.png test_images/shadow_${i}.png -gravity center -composite \
test_images/text_${i}.png -gravity center -composite \
-quality 100 "test_images/test_${i}.jpg"
# Clean up temporary files
rm -f test_images/bg_${i}.png test_images/shadow_${i}.png test_images/text_${i}.png
done
echo "100 images created in the 'test_images' directory."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment