Photo Processing , Gallery and IPTC Data app

David Bovill david at openpartnership.net
Mon May 26 05:31:22 EDT 2008


OK - thanks - I'm trying to read individual metadata tags at the moment -
not quite sure which tag names to use there seem to be display ones for
output and single word keys as the actual names - looking for a way to
filter the available tag names for the ones actually present in the image -
to be used to create a menu.

This is where I am at so far:

--> EXIF
> -
> function exif_GetMetaData imageFile
>     /*
>     Using exiftool (
> http://sno.phy.queensu.ca/%7Ephil/exiftool/exiftool_pod.html#reading_examples
> )
>     print all meta information in an image, including duplicate and unknown
> tags, sorted by group (for family 1).
>     */
>
>     shell_BashParamEscape imageFile
>     put "exiftool -a -u -g1" && imageFile into someShell
>     return shell(someShell)
> end exif_GetMetaData
>
> function exif_GetTag tagName, imageFile
>     shell_BashParamEscape imageFile
>
>     --  Using exiftool (
> http://sno.phy.queensu.ca/%7Ephil/exiftool/exiftool_pod.html#reading_examples
> )
>     put "exiftool -s -" & tagName  && imageFile into someShell
>     return shell(someShell)
>
>     -- using exif (http://libexif.sourceforge.net/
> http://exif.darwinports.com/)
>     shell_BashParamEscape tagName
>     put "exif -t" && tagName && imageFile into someShell
>     return shell(someShell)
> end exif_GetTag
>
> -- on exif_SetTag tagName, imageFile, tagValue
>     shell_BashParamEscape imageFile
>     shell_BashParamEscape tagName
>     put "exif -t" && tagName && imageFile into someShell
>     return shell(someShell)
> end exif_SetTag
>
> function exif_ListTags imageFile
>     shell_BashParamEscape imageFile
>
>     -- using exiftool (
> http://sno.phy.queensu.ca/%7Ephil/exiftool/exiftool_pod.html#reading_examples
> )
>     put "exiftool -list" && imageFile into someShell
>     put shell(someShell) into shellResult
>     put exif_ParseExifToolResult(shellResult, tagArray) into tagNames
>     return tagNames
>
>     get keys(tagArray)
>     sort it
>     replace "/" with "_" in it
>     return it
>
>     -- using exif (http://libexif.sourceforge.net/
> http://exif.darwinports.com/)
>     put "exif -l" && imageFile into someShell
>     return exif_ParseTagList(shellResult, tagArray)
> end exif_ListTags
>
> function exif_ParseExifToolResult shellResult, @tagArray
>     put lineoffset("Command-line shortcuts:",shellResult) into lineNum
>     put line 2 to (lineNum-1) of shellResult into availableTagNames
>     -- put line (lineNum+1) of shellResult into shortCuts
>     put line (lineNum+2) to -1 of shellResult into exifTable
>
>     set the itemdelimiter to ":"
>     repeat for each line exifLine in exifTable
>         put word 1 to -1 of item 1 of exifLine into tagName
>         put word 1 to -1 of item 2 of exifLine into tagValue
>         put tagValue into tagArray [tagName]
>     end repeat
>
>     replace CR & "  " with CR in availableTagNames
>     replace space with CR in availableTagNames
>     delete char 1 to 2 of availableTagNames
>
>     return word 1 to -1 of availableTagNames
> end exif_ParseExifToolResult
>
> function exif_ParseTagList shellResult, @tagArray, allTags
>     set the itemdelimiter to tab
>     -- put shellResult
>     delete line 1 of shellResult
>     replace "  " with tab in shellResult
>     -- if allTags is not true then filter shellResult with "*[*]*"
>     -- put shellResult
>     repeat for each line someLine in shellResult
>         get item 2 of shellResult
>         put word 1 of it into someID
>         put word 2 to -1 of item 2 of someLine into tagName
>         put someID into tagArray [tagName]
>     end repeat
>     put keys(tagArray) into tagNames
>     sort tagNames
>     return tagNames
> end exif_ParseTagList
>
> on shell_BashParamEscape @someParam
>     replace space with ("\" & space) in someParam
>     replace "|" with ("\" & "|") in someParam
> end shell_BashParamEscape
>



More information about the use-livecode mailing list