Page 1 of 1

Extracting EXIF data in JSON format

Posted: 2016-12-02T21:16:11-07:00
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?

Re: Extracting EXIF data in JSON format

Posted: 2016-12-02T22:04:51-07:00
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:

Re: Extracting EXIF data in JSON format

Posted: 2016-12-03T06:55:00-07:00
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!

Re: Extracting EXIF data in JSON format

Posted: 2016-12-03T12:21:21-07:00
by fmw42
This will write only the EXIF data to a file

Code: Select all

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