Extracting EXIF data in JSON format

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
janko-m
Posts: 4
Joined: 2014-09-24T10:56:15-07:00
Authentication code: 6789

Extracting EXIF data in JSON format

Post by janko-m »

I've recently found out that you can fetch the `identify -verbose` data in JSON format by doing `convert image.jpg json:`, which is really cool!

Currently I'm fetching EXIF information using `identify -format '%[EXIF:*]'`, since it's much faster than fetching all image data. However, it's not so straightforward to parse the output, because some EXIF data span multiple lines. Is it possible to retrieve only the EXIF data in JSON format?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Extracting EXIF data in JSON format

Post by snibgo »

janko-m wrote:Is it possible to retrieve only the EXIF data in JSON format?
I don't think so. However, this is quicker:

Code: Select all

convert image.jpg[1x1+0+0] json:
snibgo's IM pages: im.snibgo.com
janko-m
Posts: 4
Joined: 2014-09-24T10:56:15-07:00
Authentication code: 6789

Re: Extracting EXIF data in JSON format

Post by janko-m »

snibgo wrote:
janko-m wrote:Is it possible to retrieve only the EXIF data in JSON format?
I don't think so. However, this is quicker:

Code: Select all

convert image.jpg[1x1+0+0] json:
That's a great solution, and it has about the same speed as fetching the EXIF data directly. Thanks!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Extracting EXIF data in JSON format

Post by fmw42 »

This will write only the EXIF data to a file

Code: Select all

convert DSC_0001.JPG -format "%[EXIF:*]" info: > tmp.json
Post Reply