Hi,
Working for a book publisher, a large part of my job is producing thumbnail images of front covers for a variety of purposes (print and web based). I had originally set up a set of Photoshop actions to do it, but decided to try Image Events. The following script outputs 20 versions of an original, full-sized 300dpi tiff version, and dumps them in a new folder on your desktop (you’ll have to change the home account name to run it). I’m sure it can be done better, with fewer steps, but it works fine as it is).
display dialog "OK, what's the ISBN? (No hyphens!)" default answer ""
set theISBN to text returned of result as string
delay 3
-- 5in T, 300 dpi tiff routine
tell application "Finder"
set theFolder to make new folder at folder "Desktop" of folder "kevin" of folder "Users" of startup disk with properties {name:"Vxxx"}
set theOriginal to choose file
delay 5
set name of theOriginal to "Vxxx_5inT_300dpi.tif"
delay 3
duplicate file theOriginal to theFolder
set theImage to "/Users/kevin/Desktop/Vxxx/Vxxx_5inT_300dpi.tif"
tell application "Image Events"
launch
try
set thePic to open theImage
set my_dimensions to dimensions of thePic
set my_x to item 1 of my_dimensions as integer
set my_y to item 2 of my_dimensions as integer
if my_y > 1500 then
set theScale to (1500 / my_y)
scale thePic by factor theScale
save thePic
close thePic
end if
end try
quit
end tell
-- 4.5in T, 300dpi tiff routine
set theNextOne to (desktop as text) & "Vxxx_5inT_300dpi.tif" as alias
set name of theNextOne to "Vxxx_4.5inT_300dpi.tif"
set theFolder to folder "Vxxx" of folder "Desktop" of folder "kevin" of folder "Users" of startup disk
delay 3
duplicate file theNextOne to theFolder
set theImage to "/Users/kevin/Desktop/Vxxx/Vxxx_4.5inT_300dpi.tif"
tell application "Image Events"
launch
try
set thePic to open theImage
set my_dimensions to dimensions of thePic
set my_x to item 1 of my_dimensions as integer
set my_y to item 2 of my_dimensions as integer
if my_y > 1350 then
set theScale to (1350 / my_y)
scale thePic by factor theScale
save thePic
close thePic
end if
end try
quit
end tell
-- 3in T 300dpi tiff routine
set theThirdOne to (desktop as text) & "Vxxx_4.5inT_300dpi.tif" as alias
set name of theThirdOne to "Vxxx_3inT_300dpi.tif"
set theFolder to folder "Vxxx" of folder "Desktop" of folder "kevin" of folder "Users" of startup disk
delay 3
duplicate file theThirdOne to theFolder
set theImage to "/Users/kevin/Desktop/Vxxx/Vxxx_3inT_300dpi.tif"
tell application "Image Events"
launch
try
set thePic to open theImage
set my_dimensions to dimensions of thePic
set my_x to item 1 of my_dimensions as integer
set my_y to item 2 of my_dimensions as integer
if my_y > 900 then
set theScale to (900 / my_y)
scale thePic by factor theScale
save thePic
close thePic
end if
end try
quit
end tell
-- 50mm Wide 300dpi tiff routine
set theFourthOne to (desktop as text) & "Vxxx_3inT_300dpi.tif" as alias
set name of theFourthOne to "Vxxx_50mmW_300dpi.tif"
set theFolder to folder "Vxxx" of folder "Desktop" of folder "kevin" of folder "Users" of startup disk
delay 3
duplicate file theFourthOne to theFolder
set theImage to "/Users/kevin/Desktop/Vxxx/Vxxx_50mmW_300dpi.tif"
tell application "Image Events"
launch
try
set thePic to open theImage
set my_dimensions to dimensions of thePic
set my_x to item 1 of my_dimensions as integer
set my_y to item 2 of my_dimensions as integer
if my_x > 591 then
set theScale to (591 / my_x)
scale thePic by factor theScale
save thePic
close thePic
end if
end try
quit
end tell
-- 35mm Wide 300dpi tiff routine
set theFifthOne to (desktop as text) & "Vxxx_50mmW_300dpi.tif" as alias
set name of theFifthOne to "Vxxx_35mmW_300dpi.tif"
set theFolder to folder "Vxxx" of folder "Desktop" of folder "kevin" of folder "Users" of startup disk
delay 3
duplicate file theFifthOne to theFolder
set theImage to "/Users/kevin/Desktop/Vxxx/Vxxx_35mmW_300dpi.tif"
tell application "Image Events"
launch
try
set thePic to open theImage
set my_dimensions to dimensions of thePic
set my_x to item 1 of my_dimensions as integer
set my_y to item 2 of my_dimensions as integer
if my_x > 413 then
set theScale to (413 / my_x)
scale thePic by factor theScale
save thePic
close thePic
end if
end try
quit
end tell
-- full size 300dpi tiff routine
set theSixthOne to (desktop as text) & "Vxxx_35mmW_300dpi.tif" as alias
set name of theSixthOne to "Vxxx_full_size_300dpi.tif"
set theFolder to folder "Vxxx" of folder "Desktop" of folder "kevin" of folder "Users" of startup disk
duplicate file theSixthOne to theFolder
delay 3
-- 5in T 300dpi jpg routine
set theSeventhOne to (desktop as text) & "Vxxx_full_size_300dpi.tif" as alias
set theFolder to folder "Vxxx" of folder "Desktop" of folder "kevin" of folder "Users" of startup disk
tell application "Image Events"
launch
set theImageReference to open theSeventhOne
tell theImageReference
save in (theFolder as string) & "Vxxx 5in T 300dpi.jpg" as JPEG
close
end tell
end tell
-- 4.5 in T 300dpi JPEG routine
set theEighthOne to (desktop as text) & "Vxxx_full_size_300dpi.tif" as alias
set theFolder to folder "Vxxx" of folder "Desktop" of folder "kevin" of folder "Users" of startup disk
tell application "Image Events"
launch
try
set thePic to open theEighthOne
set my_dimensions to dimensions of thePic
set my_x to item 1 of my_dimensions as integer
set my_y to item 2 of my_dimensions as integer
if my_y > 1350 then
set theScale to (1350 / my_y)
scale thePic by factor theScale
tell thePic
save in (theFolder as string) & "Vxxx_4.5in_T_300dpi.jpg" as JPEG
close
end tell
end if
end try
end tell
-- convert the original file to RGB
set thePicture to "/Users/kevin/Desktop/Vxxx_full_size_300dpi.tif"
do shell script "/usr/bin/sips -m '/System/Library/ColorSync/Profiles/Generic RGB Profile.icc' " & " " & thePicture
-- ISBN 4.5in T 300dpi JPEG routine
set theNinthOne to (desktop as text) & "Vxxx_full_size_300dpi.tif" as alias
set theFolder to folder "Vxxx" of folder "Desktop" of folder "kevin" of folder "Users" of startup disk
tell application "Image Events"
launch
try
set thePic to open theNinthOne
set my_dimensions to dimensions of thePic
set my_x to item 1 of my_dimensions as integer
set my_y to item 2 of my_dimensions as integer
if my_y > 1350 then
set theScale to (1350 / my_y)
scale thePic by factor theScale
tell thePic
save in (theFolder as string) & theISBN & ".jpg" as JPEG
close
end tell
end if
end try
end tell
-- full size @ 100dpi tif
set theTenthOne to "/Users/kevin/Desktop/Vxxx_full_size_300dpi.tif"
do shell script "/usr/bin/sips -s dpiHeight 100 -s dpiWidth 100" & " " & theTenthOne
set theFolder to folder "Vxxx" of folder "Desktop" of folder "kevin" of folder "Users" of startup disk
tell application "Image Events"
launch
try
set thePic to open theTenthOne
set my_dimensions to dimensions of thePic
set my_x to item 1 of my_dimensions as integer
set my_y to item 2 of my_dimensions as integer
if my_y > 1063 then
set theScale to (1063 / my_y)
scale thePic by factor theScale
tell thePic
save in (theFolder as string) & "Vxxx__fullsize_100dpi.tif" as TIFF
close
end tell
end if
end try
end tell
-- N 100dpi jpeg
set theEleventhOne to "/Users/kevin/Desktop/Vxxx_full_size_300dpi.tif"
--do shell script "/usr/bin/sips -s dpiHeight 100 -s dpiWidth 100" & " " & theEleventhOne
set theFolder to folder "Vxxx" of folder "Desktop" of folder "kevin" of folder "Users" of startup disk
tell application "Image Events"
launch
try
set thePic to open theEleventhOne
set my_dimensions to dimensions of thePic
set my_x to item 1 of my_dimensions as integer
set my_y to item 2 of my_dimensions as integer
if my_y > 1063 then
set theScale to (1063 / my_y)
scale thePic by factor theScale
tell thePic
save in (theFolder as string) & "- N 100dpi.jpg" as JPEG
close
end tell
end if
end try
end tell
-- B 100dpi tiff
set theTwelfthOne to "/Users/kevin/Desktop/Vxxx_full_size_300dpi.tif"
set theFolder to folder "Vxxx" of folder "Desktop" of folder "kevin" of folder "Users" of startup disk
tell application "Image Events"
launch
try
set thePic to open theTwelfthOne
set my_dimensions to dimensions of thePic
set my_x to item 1 of my_dimensions as integer
set my_y to item 2 of my_dimensions as integer
if my_y > 574 then
set theScale to (574 / my_y)
scale thePic by factor theScale
tell thePic
save in (theFolder as string) & "- B 100dpi.tif" as TIFF
close
end tell
end if
end try
end tell
-- 400px T 72dpi jpg
set theThirteenthOne to "/Users/kevin/Desktop/Vxxx_full_size_300dpi.tif"
do shell script "/usr/bin/sips -s dpiHeight 72 -s dpiWidth 72" & " " & theThirteenthOne
set theFolder to folder "Vxxx" of folder "Desktop" of folder "kevin" of folder "Users" of startup disk
tell application "Image Events"
launch
try
set thePic to open theThirteenthOne
set my_dimensions to dimensions of thePic
set my_x to item 1 of my_dimensions as integer
set my_y to item 2 of my_dimensions as integer
if my_y > 400 then
set theScale to (400 / my_y)
scale thePic by factor theScale
tell thePic
save in (theFolder as string) & "Vxxx 400px T 72dpi.jpg" as JPEG
close
end tell
end if
end try
end tell
-- 5in T 72dpi
set theFourteenthOne to "/Users/kevin/Desktop/Vxxx_full_size_300dpi.tif"
set theFolder to folder "Vxxx" of folder "Desktop" of folder "kevin" of folder "Users" of startup disk
tell application "Image Events"
launch
try
set thePic to open theFourteenthOne
set my_dimensions to dimensions of thePic
set my_x to item 1 of my_dimensions as integer
set my_y to item 2 of my_dimensions as integer
if my_y > 360 then
set theScale to (360 / my_y)
scale thePic by factor theScale
tell thePic
save in (theFolder as string) & "Vxxx 5in T 72dpi.jpg" as JPEG
close
end tell
end if
end try
end tell
-- Web large 72dpi
set theFifteenthOne to "/Users/kevin/Desktop/Vxxx_full_size_300dpi.tif"
set theFolder to folder "Vxxx" of folder "Desktop" of folder "kevin" of folder "Users" of startup disk
tell application "Image Events"
launch
try
set thePic to open theFifteenthOne
set my_dimensions to dimensions of thePic
set my_x to item 1 of my_dimensions as integer
set my_y to item 2 of my_dimensions as integer
if my_y > 320 then
set theScale to (320 / my_y)
scale thePic by factor theScale
tell thePic
save in (theFolder as string) & "Vxxx web large.jpg" as JPEG
close
end tell
end if
end try
end tell
-- 4in T 72dpi
set theSixteenthOne to "/Users/kevin/Desktop/Vxxx_full_size_300dpi.tif"
set theFolder to folder "Vxxx" of folder "Desktop" of folder "kevin" of folder "Users" of startup disk
tell application "Image Events"
launch
try
set thePic to open theSixteenthOne
set my_dimensions to dimensions of thePic
set my_x to item 1 of my_dimensions as integer
set my_y to item 2 of my_dimensions as integer
if my_y > 288 then
set theScale to (288 / my_y)
scale thePic by factor theScale
tell thePic
save in (theFolder as string) & "Vxxx 4in T 72dpi.jpg" as JPEG
close
end tell
end if
end try
end tell
-- 3in T 72dpi
set theSeventeenthOne to "/Users/kevin/Desktop/Vxxx_full_size_300dpi.tif"
set theFolder to folder "Vxxx" of folder "Desktop" of folder "kevin" of folder "Users" of startup disk
tell application "Image Events"
launch
try
set thePic to open theSeventeenthOne
set my_dimensions to dimensions of thePic
set my_x to item 1 of my_dimensions as integer
set my_y to item 2 of my_dimensions as integer
if my_y > 216 then
set theScale to (216 / my_y)
scale thePic by factor theScale
tell thePic
save in (theFolder as string) & "Vxxx 3in T 72dpi.jpg" as JPEG
close
end tell
end if
end try
end tell
-- 50mm W 72dpi
set theEighteenthOne to "/Users/kevin/Desktop/Vxxx_full_size_300dpi.tif"
set theFolder to folder "Vxxx" of folder "Desktop" of folder "kevin" of folder "Users" of startup disk
tell application "Image Events"
launch
try
set thePic to open theEighteenthOne
set my_dimensions to dimensions of thePic
set my_x to item 1 of my_dimensions as integer
set my_y to item 2 of my_dimensions as integer
if my_x > 142 then
set theScale to (142 / my_x)
scale thePic by factor theScale
tell thePic
save in (theFolder as string) & "Vxxx 50mm W 72dpi.jpg" as JPEG
close
end tell
end if
end try
end tell
-- web medium 72dpi PNG
set theNineteenthOne to "/Users/kevin/Desktop/Vxxx_full_size_300dpi.tif"
set theFolder to folder "Vxxx" of folder "Desktop" of folder "kevin" of folder "Users" of startup disk
tell application "Image Events"
launch
try
set thePic to open theNineteenthOne
set my_dimensions to dimensions of thePic
set my_x to item 1 of my_dimensions as integer
set my_y to item 2 of my_dimensions as integer
if my_y > 156 then
set theScale to (156 / my_y)
scale thePic by factor theScale
tell thePic
save in (theFolder as string) & "Vxxx web med 72dpi.png" as PNG
close
end tell
end if
end try
end tell
-- web small 72dpi PNG
set theTwentiethOne to "/Users/kevin/Desktop/Vxxx_full_size_300dpi.tif"
set theFolder to folder "Vxxx" of folder "Desktop" of folder "kevin" of folder "Users" of startup disk
tell application "Image Events"
launch
try
set thePic to open theTwentiethOne
set my_dimensions to dimensions of thePic
set my_x to item 1 of my_dimensions as integer
set my_y to item 2 of my_dimensions as integer
if my_y > 81 then
set theScale to (81 / my_y)
scale thePic by factor theScale
tell thePic
save in (theFolder as string) & "Vxxx web small 72dpi.png" as PNG
close
end tell
end if
end try
end tell
end tell
Model: 27in imac, 3.06 ghz
AppleScript: AppleScript 2.2.3
Browser: Safari 536.26.14
Operating System: Mac OS X (10.8)