Resize and Watermark Script?
Posted: 2011-10-24T11:59:12-07:00
I want to create an Applescript that will resize and watermark a bunch of images using ImageMagick. I realize that I have to create a shell script (or something) within the Applescript to get this to work, that's fine, I just want ONE droplet that will do all of this automatically.
I know nothing about any of this and have spent days trying to piece something together that works. My existing script was just a re-sizer which didn't utilize ImageMagick. I want to combine that script plus a watermarking script that uses IM. However, i'd also be open to using IM to resize the image as well, if that's easier to figure out.
This is my re-sizer.
And this is my watermarking script which i've found online and can't get to work.
Any suggestions? In all honesty, i'd be happy to pay someone a few dollars via PayPal to just write this thing for me. I've spent 20+ hours trying to figure this out already and i'm sure someone who actually knows how can execute this in 5 minutes. Can anybody help me?
I know nothing about any of this and have spent days trying to piece something together that works. My existing script was just a re-sizer which didn't utilize ImageMagick. I want to combine that script plus a watermarking script that uses IM. However, i'd also be open to using IM to resize the image as well, if that's easier to figure out.
This is my re-sizer.
Code: Select all
on open some_items
repeat with this_item in some_items
try
rescale_and_save(this_item)
end try
end repeat
end open
to rescale_and_save(this_item)
tell application "Image Events"
launch
set the target_width to 640
-- open the image file
set this_image to open this_item
set typ to this_image's file type
copy dimensions of this_image to {current_width, current_height}
if current_width is greater than current_height then
scale this_image to size target_width
else
-- figure out new height
-- y2 = (y1 * x2) / x1
set the new_height to (current_height * target_width) / current_width
scale this_image to size new_height
end if
tell application "Finder" to set new_item to ¬
(container of this_item as string) & "s_" & (name of this_item)
save this_image in new_item as typ
end tell
end rescale_and_save
Code: Select all
on open theObjects
repeat with theObject in theObjects
do shell script "/opt/local/bin/composite -compose Over " & �
"-gravity southwest /Users/airborne/Pictures/copyright.gif '" & �
(POSIX path of theObject as string) & "' '" & (POSIX path of theObject as string) & "'"
end repeat
end open