Hello, does anyone know if it is possible to get the unit of num|value? In the perfect world, maybe something like this:
exiftool.exe -FileSize -ExposureTime -CreateDate -struct -l -j "C:\storage\samples\RAW_CANON_50D.CR2"
[{
"SourceFile": "C:/storage/samples/RAW_CANON_50D.CR2",
"FileSize": {
"desc": "File Size",
"unit": "byte", ///** magic unit here **///
"num": 18935626,
"val": "18 MB"
},
"ExposureTime": {
"desc": "Exposure Time",
"unit": "fraction", ///** magic unit here **///
"num": 0.0125,
"val": "1/80"
},
"CreateDate": {
"desc": "Create Date",
"unit": "date", ///** magic unit here **///
"val": "2008:09:17 15:13:40"
},
etc...
It would be very useful for my current project which is not tied to specific file types or metadata groups or even media types. If I could get the values strongly typed it would really help with efficient db storage/queries and ui controls.
Thanks for any help or ideas.
-Max
Other than devising a table that maps tag to unit yourself, I don't think there is an automatic way. The unit of a value is directly coupled to the meaning of the tag, there is basically no conversion done, only formatting.
Ok, thanks. I have been digging around some more and according to http://www.exiftool.org/under.html all values (ValueConv with -n) get normalized to a unit before display formatting (PrintConv). I am going to look through the exifTool source, maybe I'll get lucky and find a handy tag-name:unit lookup I can port.
I don't think you'll have any luck with that, but feel free to look at the source anyway. :)
- Phil