The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > Developer > AppleScripting Omni Apps
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Using Meta Data in Image Thread Tools Search this Thread Display Modes
Hi,

Is it feasible to extract some of the meta data associated with a photograph and have it displayed in a text box? I am looking to produce a template that will allow me to create a "photo book" that I will print out locally and I would like to include capture date and caption as text.

best wishes

Simon
 
You may find some reusable Applescript elements in this, which shows how to read any "Creation" tag which may be present in the file.

Code:
property pTitle : "Place several images     Ver 0.6" -- IN OMNIGRAFFLE
property plngAcross : 4 -- number of thumbnails to place in a row
property prScale : 0.2 -- thumbnail size as a proportion of full size
property pblnShadow : false


-- CHOOSE SOME IMAGES (SELECTING SEVERAL IMAGES FROM THE FILE DIALOG)
tell application id "sevs"
	activate
	set lstFiles to (choose file with prompt "Place one or more images" with multiple selections allowed)
	
end tell

-- PLACE ALL THE SELECTED IMAGES IN A NEW DOCUMENT
tell application id "OGfl"
	activate
	tell front canvas of (make new document with properties {automatic layout:false})
		set {rOriginX, rOriginY} to {0, 0}
		set lngMaxHeight to 0
		
		set i to 0
		set my text item delimiters to "/"
		repeat with oFile in lstFiles
			try
				-- GET THE DIMENSIONS AND (ANY CREATION TAG) OF THE FILE
				set strFile to POSIX path of oFile
				tell application id "imev"
					tell (open file strFile)
						set {rX, rY} to dimensions
						try
							set strCreation to value of metadata tag "Creation"
						on error
							set strCreation to ""
						end try
						close saving no
					end tell
				end tell
				
				-- SCALE DOWN TO THUMBNAIL
				set {lngWidth, lngHeight} to {rX * prScale, rY * prScale}
				
				-- AT THE END OF THE ROW RETURN TO LEFT HAND PAGE, AND MOVE DOWN A ROW
				if i ≥ plngAcross then
					set rOriginX to 0
					set rOriginY to rOriginY + lngMaxHeight
					set lngMaxHeight to 0
					set i to 0
				else
					-- RECORD THE MAXIMUM DEPTH IN THE CURRENT ROW OF THUMBNAILS
					if lngHeight > lngMaxHeight then set lngMaxHeight to lngHeight
				end if
				
				-- CREATE A THUMBNAIL with [folder/filename] of source image in url
				set strPathEnd to (items -2 thru -1 of (text items of strFile)) as string
				make new shape with properties {origin:{rOriginX, rOriginY}, size:{lngWidth, lngHeight}, draws stroke:false, fill:no fill, draws shadow:pblnShadow, image:strFile, url:strPathEnd}
				
				-- AND INCREMENT THE HORIZONTAL POSITION
				set rOriginX to rOriginX + lngWidth
				set i to i + 1
			on error
				display alert strFile & " does not appear to be a graphic file ..."
			end try
		end repeat
		set my text item delimiters to space
	end tell
end tell
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Project Meta Data Feature Request gcrump OmniFocus 1 for Mac 3 2010-01-24 05:38 AM
Meta system diagram structure & OF omnibob OmniFocus 1 for Mac 2 2008-07-06 01:43 PM
Meta Tags In OOP? WrongSizeGlass OmniOutliner 3 for Mac 1 2007-01-20 01:13 PM
Meta Pivots vanderwal OmniFocus 1 for Mac 6 2007-01-11 06:07 AM
Drag linked image downloads the image Handycam OmniWeb Feature Requests 31 2006-11-13 02:40 AM


All times are GMT -8. The time now is 07:19 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.