Created
March 26, 2025 17:38
-
-
Save fffej/f6389c7cebaeacb5c49817f30d93e45b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| mkdir -p Queen-Resized-BW Rook-resize-BW bishop_resized-BW knight-resize-BW pawn_resized-BW | |
| for dir in Queen-Resized Rook-resize bishop_resized knight-resize pawn_resized; do | |
| output_dir="${dir}-BW" | |
| echo "Processing images in $dir..." | |
| # Process each JPG in the directory | |
| for img in "$dir"/*.jpg; do | |
| # Get just the filename without path and extension | |
| filename=$(basename "$img" .jpg) | |
| echo " Converting $filename" | |
| # Run Canny edge detection, resize to 64x64, convert to 1-bit black and white | |
| convert "$img" \ | |
| -canny 0x1+10%+30% \ | |
| -resize 64x64! \ | |
| -monochrome \ | |
| "$output_dir/${filename}.png" | |
| done | |
| done | |
| echo "Processing complete!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment