Easily sorting through thousands of photos with the magic of BASH

I just needed a quick way to sort through thousands of photos, in order to decide what to keep. So I wrote this simple script:


#!/usr/bin/env bash
for file in ./*; do
img2sixel $file
read -p "Keep [k], delete [D] or edit [e] $file? (Default: Keep)" KkDEe
case $KkDEe in
[D]* ) rm $file;;
[Ee]* ) echo "Starting rawtherapee..." && rawtherapee $file;;
[Kk]* ) ;;
* ) ;;
esac
done

(Unfortunately WordPress removes leading spaces for the code block *sigh*)

(This only works if the folder contains just image files, you might want to instead use something like for file in ./*.jpg instead if you only want to look at a specific file type. Otherwise you will get warnings for files that cannot be displayed as images. In my case photo folders only contain photos.)

Requirements:

– BASH (so simple it can be adapted to other shells easily)
– img2sixel
– terminal emulator that can display SIXEL graphics (such as foot, for example)

This will then show each photos in your terminal along with the question of whether to keep it:

Screenshot: Shows a terminal displaying the lower part of the flag for the United Federation of Planets, along the question of whether to keep it.

One of the options is to open it in in Rawtherapee, which I occasionally use to fix exposure.

I have an alias sort_through_photos, which allows me to simply type this in and immediately start sorting through photos comfortably, regardless of what folder I am in.