You can send standard output to multiple processes at the same time using tee:
You can find out if a file is binary using the command “file” and a simple grep operation:
And you can find out if a file is an image using xdg-mime:
if [ “$mimetype” = “” ]; then
echo “Not an image, skipping.”
Mind you, I started doing this about three hours ago. Because this scene from Malcom in the Middle is what any kind of programming is like.