Created
October 28, 2022 22:36
-
-
Save phargogh/177b9ae5d7bb2e1a9d491e0c9eb1f978 to your computer and use it in GitHub Desktop.
Bash script: cat an image to stdout and ask whether the image contains text to be translated.
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 | |
# This script runs within iterm2 to print images to the commandline and | |
# ask whether there's text that should be translated. | |
# | |
# Developed to run within the context of the InVEST user's guide, | |
# executing this from within the source/ directory. | |
NO_TRANSLATE_FILE=images_that_should_not_be_translated.txt | |
YES_TRANSLATE_FILE=images_that_SHOULD_be_translated.txt | |
rm -f NO_TRANSLATE_FILE YES_TRANSLATE_FILE | |
for file in $(find . -name "*.png" -or -name "*.jpg" -or -name "*.PNG") | |
do | |
/Users/jdouglass/.iterm2/imgcat $file | |
echo "FILENAME: $file" | |
echo "y : yes, this image contains text that should be translated" | |
echo "n : no, this image contains no text to be translated." | |
echo -n "Type y or n :" | |
read -n 1 a | |
printf "\n" | |
case $a in | |
"y" ) echo "$file" >> $YES_TRANSLATE_FILE;; | |
"n" ) echo "$file" >> $NO_TRANSLATE_FILE;; | |
* ) echo "Try again.";; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment