So I figured that since you guys helped me I’ll post the useful stuff I made with that help. This little script uses graphicconverter to add the date to the bottom right of the image. Its not the cleanest code around, and it isn’t as user friendly as it could be (i.e., some of the settings about the text size and placement could be more transparent), but it works. Any and all suggestions, criticism, and possible improvements are highly welcome. Here goes:
-- get the folder, make list of files inside, count them
set welcomeText to "This script will take a folder full of pictures and add the date the picture was taken (based on the creation date) to the bottom right-hand corner of all the pictures using GraphicConverter. If you do not own GraphicConverter, this script will not function."
display dialog welcomeText
set pictureFolder to choose folder
tell application "Finder"
set listOfFiles to every file of pictureFolder
set numberOfFiles to count of listOfFiles
end tell
tell application "GraphicConverter" to get registered
delay 2 -- have it launch now
-- for each file...
repeat with thisFile in listOfFiles
-- set the name; it'll be useful later in the fullFilePath thing
set fileName to name of thisFile
-- this is the date we want to put on the pictures
set creationDate to creation date of thisFile
set fullFilePath to ((POSIX path of pictureFolder as string) & fileName) as string
-- close open windows so that the frontmost one is always our file
set width to last word of (do shell script "sips -g pixelWidth " & fullFilePath) as integer
set height to last word of (do shell script "sips -g pixelHeight " & fullFilePath) as integer
-- get file imageinfo thisFile as alias -- this would have worked also, after the fact
-- we always want the date to be in the same spot no matter the size of the image. Here we calculate, based on a user-defined right and bottom buffer and a user-defined size of the textbox, (1) how large the textbox in which the date resides should be, and (2) the size of the text to best fit the image. Note that while I tried to put in some measures to account for vertical pictures, it isn't battle tested and likely won't work very well.
set dateHeight to 0.1 -- how tall the date textbox should be, as a percent of the total image height
set dateWidth to 0.4 -- same as above for width
set bottomBuffer to height / 40 as integer -- same as above for size of bottom buffer... the space between the date and the bottom of the image
set rightBuffer to width / 100 * 4 as integer -- same as above for right buffer
set boxHeight_Top to height - (height * dateHeight) - bottomBuffer as integer
set boxHeight_Bottom to height - bottomBuffer as integer
set boxWidth_left to width - (width * dateWidth) - rightBuffer as integer
set boxWidth_Right to width - rightBuffer as integer
if height < width then
set textSize to ((boxHeight_Bottom - boxHeight_Top) / 2) - 3 as integer
else
set textSize to ((boxWidth_Right - boxWidth_left) / 5) - 3 as integer
end if
set textToAdd to date_format(creationDate as string)
-- add the text to the window, use the calculations above to figure out where it should be and how large
tell application "GraphicConverter"
open thisFile
delay 1
-- see the GraphicConverter dictionary for other possible options
draw text into front window text textToAdd as string justification 0 color {64000, 50000, 31000} box {boxWidth_left, boxHeight_Top, boxWidth_Right, boxHeight_Bottom} font "Arial" size textSize textface 1 with antialias
save front window
close front window
end tell
end repeat
-- this is used to make the date shorter (xx/xx/xx instead of "Saturday, January...")
on date_format(old_date)
set {year:y, month:m, day:d} to date old_date
tell (y * 10000 + m * 100 + d) as string to text 1 thru 4 & "-" & text 5 thru 6 & "-" & text 7 thru 8 & " " & items -11 thru -1 of old_date
end date_format