images_to_hex.sh 827 B

1234567891011121314151617181920212223
  1. #!/usr/bin/bash
  2. # Converts every image *.png to *.txt as an ASCII hex representation of the image.
  3. #
  4. # This script simply runs image_to_code.py on each of the folders containing
  5. # our images and writes the hex of each image to a text file. Instead of updating
  6. # the original script, I left it to be generic as it was originally intended
  7. # in case someone else finds it useful. The original python script outputs
  8. # header and implementation files, which this script removes after it is run.
  9. allImageFolders="filetypes range-slider toolbar misc"
  10. for dir in $allImageFolders; do
  11. rm $dir/*.txt
  12. for image in `ls $dir`; do
  13. name=`basename $image .png`
  14. outfile=$dir/$name.txt
  15. echo "Output file: $outfile"
  16. ./image_to_code.py -i $dir/$image -c $name > "$outfile"
  17. done
  18. done
  19. rm -rf *PNG.[hm]