Awesome
Exif to RDF
This tiny tool extracts Exif data from a JPEG image file, and converts it into RDF/XML. Provide image file path as an argument, then it outputs the resulting RDF to STDOUT.
perl exif2rdf.pl <imagefile>
Requires definition file "exif-tags.json" in the same directory. Also requires Image::ExifTool and JSON modules.
Tag-RDF Definition JSON
exif-tags.json is a mapping file from Exif tag number to RDF property (defined in Exif data description vocabulary ).
The root object has keys as Eixf tags, and each value object has RDF property name propName
and additional information such as default
, or values
array to map Exif values to RDF objects .
{
"283" : {
"propName" : "yResolution",
"default" : "72",
"datatype" : "&xsd;decimal"
},
"284" : {
"propName" : "planarConfiguration",
"values" : {
"1" : "chunky-format",
"2" : "planar-format"
}
}
}
The above example describes that
- tag
283
will be interpreted as RDF propertyyResolution
whose datatype isxsd:decimal
, and default value is72
. - tag
284
as propertyplanarConfiguration
, and for Exif value1
the RDF value ischunky-format
, and Exif2
the RDFplanar-format
.
Note that tag numbers for GPS IFD, Interoperability IFD and PIM IFD will have a prefix 'g', 'i' and 'p' respectively.
Background
This is an old perl script written in 2007, but still works (as of 2017). See also a half-written document about Photo and RDF (mostly in Japanese).