Skip to content

Instantly share code, notes, and snippets.

@trauber
Created July 25, 2019 19:47
Show Gist options
  • Save trauber/8e82c70dba4dba5e099f255fe36a34d2 to your computer and use it in GitHub Desktop.
Save trauber/8e82c70dba4dba5e099f255fe36a34d2 to your computer and use it in GitHub Desktop.
Make a JSON List of Photos #json
# Use find and file to crawl for files with mime-type image/jpeg or image/png.
# Awk isolates file names.
# rjgpcom gets comments, if any.
# jo wraps everything up into json for jsongallery.
#
# https://jpmens.net/2016/03/05/a-shell-command-to-create-json-jo
# https://github.com/mariobox/jsongallery
findlist=$(find . -type f -exec file -i {} \; \
| awk '{if ($2 == "image/jpeg;" || $2 == "image/png;") {img=$1; sub(/:$/,"",$1);print $1}}')
for j in $findlist; do
comment=$(rdjpgcom $j 2>&1)
jo url=$j description="$comment"
done | jo -p -a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment