Skip to content

Instantly share code, notes, and snippets.

@ca057
Last active July 9, 2025 23:42
Show Gist options
  • Save ca057/b4dc3128234d03045ef8b881833e3da5 to your computer and use it in GitHub Desktop.
Save ca057/b4dc3128234d03045ef8b881833e3da5 to your computer and use it in GitHub Desktop.
Extracting EXIF data into JSON

command line tools for working with images to json

Extract all exif data as list into a json file:

exiftool -j -q dir > data.json

Sort the exif data by the original creation time:

jq 'sort_by(.DateTimeOriginal)' data.json

Extract exif data and sort by original creation time:

exiftool -j -q *.jpg | jq 'sort_by(.DateTimeOriginal)' > data.json
@Deankinyua
Copy link

is there a way i can just get the object and not in a list ?

@ca057
Copy link
Author

ca057 commented Nov 21, 2024

I’m not entirely sure what you want to achieve, but this should be a solution (let me know if this is not the case or you have another case in mind):

If you want to have the exif data of just a single file, call exiftool only on that file and extract the first (and therefore only) element of the array using jq:

exiftool -j -q your-image.jpg | jq '.[0]'
# alternatively write it to a file
exiftool -j -q your-image.jpg | jq '.[0]' > data.json

@Deankinyua
Copy link

Thanks let me see if this is what I'm looking for

@otonoton
Copy link

otonoton commented Jul 9, 2025

This seems to leave out a lot of information compared to using -all:all, even if you combine that with -j. For example with -j I only get a single TagName key, but with -all:all it shows 20 different tags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment