Python: exif to rdf ( exif2rdf.py )

Hi Dan, Hi Masahide,

I'm working on a small python program which is reading the EXIF data on  
an image and write them as an RDF file.
I'm using to read the data a modified version of Thierry Bousch done by

[[[
# Contains code from "exifdump.py" originally written by Thierry Bousch
# <bousch@topo.math.u-psud.fr> and released into the public domain.
# Updated and turned into general-purpose library by Gene Cash
# <gcash@cfl.rr.com>
]]] - EXIF.py

1) Do you know if there's a more recent version of a library?
	I found surprising that there's no maintained version of
	an exif lib being in touch with the different versions
	of EXIF.

2) Do you think the schema that we are hosting now is good?
	http://www.w3.org/2003/12/exif/

3) I'm not sure the example I put online was correct when I did it one  
year ago? What do you think about it?
	http://www.w3.org/2003/12/exif/Overview#example

4) Depending on that I might modify the EXIF python library to have an  
option switch that will help people to have either:
	- a list of tags {'tags_name':'value', …}
	- an RDF file (object)

But maybe all of that already exists?

I'll send the first version of the program as soon as I have an answer  
for the previous questions. :)

Thanks.

Just as proof of concept before to go further
[[[
import EXIF
def exif2rdf(tags):
	"""
	Read the EXIF of an image under the form given by EXIF list
	{'Image XResolution': (0x011A) Ratio=300 @ 186,
	 'Image Make': (0x010F) ASCII=NIKON CORPORATION @ 158,
	 ...}
	and return an RDF file following the RDF Schema developped
	by Kanzaki.
	Note it would be better to put that in EXIF.py with a list
	ouput or an RDF ouput.
         f=open(picworkpath, 'rb')
         tags=EXIF.process_file(f)
	"""
	for i in tags:
	    if i=='EXIF DateTimeOriginal':
	        print """
<exif:IFD rdf:ID="Primary_Image">
	<exif:exif_IFD_Pointer>
		<exif:IFD>"""
	        print  
"<exif:dateTimeOriginal>"+toisodate(tags[i])+"</exif: 
dateTimeOriginal>\r"
	        print """		</exif:IFD>
	</exif:exif_IFD_Pointer>
</exif:IFD>"""

def toisodate(dateExif):
	"""
	Convert the date which is in an exif file as an ISO date.
	From
		2004:09:24 07:01:44
	to
		2004:09:24T07:01:44
	"""
	d=str(dateExif)
	d=d.replace(' ', 'T')
	return d
]]]


-- 
Karl Dubost - http://www.w3.org/People/karl/
W3C Conformance Manager
*** Be Strict To Be Cool ***

Received on Saturday, 18 December 2004 01:36:25 UTC