Extract EXIF data as text using ImageMagick
Asked Answered
P

2

51

Is there a simple way to extract EXIF data as text from an image file using ImageMagick. Something like the way to do it for IPTC data:

convert input.jpeg data.iptc <= binary data
convert input.jpeg data.iptctext <= textual data

Sadly this doesn't work for EXIF data:

convert input.jpeg data.exif <= binary data
convert input.jpeg data.exiftext <= not working

I know that i can use

identify -verbose input.jpeg

but then i would have to parse the result in order to search for all the EXIF and IPTC data.

So is there a simple way to do it with pure ImageMagick?

Perfectible answered 30/10, 2014 at 13:46 Comment(0)
I
69

Like this:

identify -format '%[EXIF:*]' image.jpg

Output:

exif:ApertureValue=4845/1918
exif:BrightnessValue=4991/792
exif:ColorSpace=1
exif:ComponentsConfiguration=1, 2, 3, 0
exif:Compression=6
exif:DateTime=2014:08:31 14:18:07
exif:DateTimeDigitized=2014:08:31 14:18:07
exif:DateTimeOriginal=2014:08:31 14:18:07
exif:ExifImageLength=2448
exif:ExifImageWidth=3264
exif:ExifOffset=204
exif:ExifVersion=48, 50, 50, 49
...
...
Intractable answered 30/10, 2014 at 13:51 Comment(5)
Thanks. That will work. One more question: do you know why "%[IPTC:*]" does not work but "%[IPTC:2:120]" does? Is * simply not supported for IPTC?Perfectible
Sadly I don't know - I have had all sorts of issues with IPTC data - it seems very tricky to handle - there may be some useful information for you in my answer here... #25999106Intractable
You might also try exiv2Intractable
@MarkSetchell if I save that data to a file would it be a valid "exif file" that could be used to inject exif data into a file that does not have any exif data?Pah
well this is bizarre. if i want to extract the EXIF creation date I have to use the tag "date:create" ... EXIF returns nothing.Menon
K
0

The syntax for graphicmagic is:

gm identify -format '%[EXIF:*]' my.jpeg
Karlynkarma answered 12/1 at 16:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.