The earlier answers stopped working for Mathematica 11+. In Mathematica 10 and earlier, the MetaInformation was a nested list of rules:
$VersionNumber
i = Import["ExampleData/coneflower.jpg","ImageWithExif"];
Options[i, MetaInformation] //Short
10.3
{MetaInformation->{Exif->{ImageDescription-> ,<<37>>,SceneType->1}}}
In Mathematica 11+, the MetaInformation is now an Association. This means that the previous approaches no longer work:
$VersionNumber
i = Import["ExampleData/coneflower.jpg","ImageWithExif"];
Quiet @ Check[
OptionValue[Options[i], MetaInformation -> "Exif" -> "ExposureTime"],
$Failed
]
Cases[Options[i], HoldPattern["ExposureTime" -> ___], Infinity]
11.3
$Failed
{}
Instead, you will need to extract information from an association. If you don't know the structure of the association you can use Keys to investigate:
meta = OptionValue[Options[i], MetaInformation];
meta //Keys
{"Exif"}
Then:
meta["Exif"] //Keys
{"Make", "Model", "Orientation", "XResolution", "YResolution",
"ResolutionUnit", "Software", "DateTime", "YCbCrPositioning", "ExposureTime", "FNumber", "ExposureProgram", "ISOSpeedRatings", "ExifVersion",
"DateTimeOriginal", "DateTimeDigitized", "ComponentsConfiguration",
"CompressedBitsPerPixel", "ExposureBiasValue", "MaxApertureValue",
"MeteringMode", "LightSource", "FlashInfo", "FocalLength", "FlashpixVersion",
"ColorSpace", "PixelXDimension", "PixelYDimension", "InteroperabilityIndex",
"InteroperabilityVersion", "FileSource", "SceneType"}
Now we see "ExposureTime". So:
meta["Exif", "ExposureTime"]
Quantity[1/65, "Seconds"]
N[Last[Last[ Cases[Options[f], HoldPattern["ExposureTime" -> ___], Infinity]]]]is what I need?! Looks a tad clunky... – cormullion Dec 05 '12 at 15:22With[{wanted = "ExposureTime"}, wanted /. Cases[Options[i], HoldPattern[wanted -> ___], Infinity] ] // N– Yves Klett Dec 05 '12 at 15:39