Devon wrote:
>  I'm interested in what information may be included in the 
>  EXIF image header, as well as other timestamp information.  
>  Does anyone have code to read this header and the other timestamps?

According to Wikipedia, the EXIF data structure is old and causes a lot of 
pain.  So while we could write an EXIF parser in J, I'd recommend using a 
battle tested version that's already worked out all the kinks.

A quick google turns up ExifTool:

   http://www.sno.phy.queensu.ca/~phil/exiftool/

It's Perl-based, and hence cross-platform.  Here's an example of how you could 
use it to extract the original photo time from an image file:

           require 'task'
           enquote    =:  '"', ,&'"'
           makeTable  =:  (({.~ ;&:deb (}.~ >:)) i.&':');._2
           lookupTag  =:  ({."1@:[  i. <;._1^:(0=L.)@:]) { a: ,~ {:"1@:[
           
           NB.  If you don't have image3 installed, just pick another JPG
           imgFn      =:  enquote jpath '~addons\media\image3\atkiln.jpg'

           NB.  Obviously point this at wherever you download exiftool
           exiftoolFn =:  enquote jpath '~tools\img\exiftool(-k).exe'
           
           NB.  The EXIF data extracted from the img
           imgExif    =:  makeTable toJ spawn exiftoolFn,' ',imgFn

           NB.  A tag of interest
           imgModDate =:  imgExif lookupTag <'File Modification Date/Time'
           
           imgModDate
        +-------------------------+
        |2007:01:15 04:26:33-05:00|
        +-------------------------+

Unfortunately I've found that the embedded EXIF 'File Modification Date/Time' 
tag is tied to the filesystem's timestamp, so it doesn't solve your problem.  
On the other hand, I tried the above on some of my personal photos, and I found 
a tag named 'Date/Time Original' which doesn't ever change.  But since it's not 
present on the image3 example image, that means that EXIF tags may not be 
consistent, and so are unreliable, so you're back to square one.

But I hope this gets you a little further.

-Dan

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to