Below is a script (Thanks Mark) that saves several filetypes with different sizes.
The jpg’s are resized to 100, 50 and 25 %
I need to change the following:
If the height is bigger than the with: resize height to 400, 180 and 80 pixels res 72
else ( width is bigger than height or equal): resize width to 500, 225 and 100 pixels res 72
Many thanks in advance,
Peter
property theFileType_A : {"8BPS"}
property theFileType_B : {"EPSF"}
set Input_Folder to choose folder with prompt "Choose a Folder w Images" without invisibles
tell application "Finder"
if not (exists folder "LAY_OUT" of Input_Folder) then
set x to make new folder at Input_Folder with properties {name:"LAY_OUT"}
set EPS_Folder to x as text
else
set EPS_Folder to folder "LAY_OUT" of Input_Folder as text
end if
if not (exists folder "JPEG_OUT" of Input_Folder) then
set y to make new folder at Input_Folder with properties {name:"JPEG_OUT"}
set JPEG_Folder to y as text
else
set JPEG_Folder to folder "JPEG_OUT" of folder Input_Folder as text
end if
set File_List to files in Input_Folder whose file type is in theFileType_B
end tell
repeat with This_File in File_List
tell application "Finder"
set The_File to This_File as alias
end tell
tell application "Adobe Photoshop CS3"
with timeout of 3600 seconds
activate
set display dialogs to never
set User_Rulers to ruler units of settings
set ruler units of settings to pixel units
open The_File
set Doc_Ref to the current document
tell Doc_Ref
set Doc_Name to name
set Base_Name to my getBaseName(Doc_Name)
tell Doc_Ref
convert to profile "sRGB IEC61966-2.1" intent perceptual with blackpoint compensation and dithering
if (bits per channel is sixteen) then
set bits per channel to eight
end if
resize image resolution 72 resample method bicubic
set Saved_State_1 to current history state
set New_Path to EPS_Folder & Base_Name & ".eps.lay"
save Doc_Ref in file New_Path as Photoshop EPS with options {class:EPS save options, embed color profile:true, encoding:medium quality JPEG, preview type:eight bit TIFF} appending no extension with copying
set current history state to Saved_State_1
if exists (path items whose kind is clipping) then
set Clip to (name of every path item whose kind is clipping)
create selection path item (item 1 of Clip) feather amount 0 with antialiasing
invert selection
fill selection with contents {class:RGB color, red:255, green:255, blue:255}
deselect
end if
set Pixel_Height to height
set Saved_State_2 to current history state
set New_Path to JPEG_Folder & Base_Name & "_100.jpg"
save Doc_Ref in file New_Path as JPEG with options {quality:6, embed color profile:true} with copying
set current history state to Saved_State_2
resize image height Pixel_Height / 2 resolution 72
set New_Path to JPEG_Folder & Base_Name & "_50.jpg"
save Doc_Ref in file New_Path as JPEG with options {quality:6, embed color profile:true} with copying
set current history state to Saved_State_2
resize image height Pixel_Height / 4 resolution 72
set New_Path to JPEG_Folder & Base_Name & "_25.jpg"
save Doc_Ref in file New_Path as JPEG with options {quality:6, embed color profile:true} with copying
close without saving
end tell
end tell
end timeout
end tell
end repeat
end
tell application "Finder"
set File_List to files in Input_Folder whose file type is in theFileType_A
end tell
repeat with This_File in File_List
tell application "Finder"
set The_File to This_File as alias
end tell
tell application "Adobe Photoshop CS3"
with timeout of 3600 seconds
activate
set display dialogs to never
set User_Rulers to ruler units of settings
set ruler units of settings to pixel units
open The_File
set Doc_Ref to the current document
tell Doc_Ref
set Doc_Name to name
set Base_Name to my getBaseName(Doc_Name)
tell Doc_Ref
convert to profile "sRGB IEC61966-2.1" intent perceptual with blackpoint compensation and dithering
if (bits per channel is sixteen) then
set bits per channel to eight
end if
resize image resolution 72 resample method bicubic
set Saved_State_1 to current history state
set New_Path to EPS_Folder & Base_Name & ".psd.lay"
save Doc_Ref in file New_Path as Photoshop format with options {class:Photoshop save options, save alpha channels:true, save layers:true, embed color profile:true} appending no extension with copying
set current history state to Saved_State_1
if exists (path items whose kind is clipping) then
set Clip to (name of every path item whose kind is clipping)
create selection path item (item 1 of Clip) feather amount 0 with antialiasing
invert selection
fill selection with contents {class:RGB color, red:255, green:255, blue:255}
deselect
end if
set Pixel_Height to height
set Saved_State_2 to current history state
set New_Path to JPEG_Folder & Base_Name & "_100.jpg"
save Doc_Ref in file New_Path as JPEG with options {quality:6, embed color profile:true} with copying
set current history state to Saved_State_2
resize image height Pixel_Height / 2 resolution 72
set New_Path to JPEG_Folder & Base_Name & "_50.jpg"
save Doc_Ref in file New_Path as JPEG with options {quality:6, embed color profile:true} with copying
set current history state to Saved_State_2
resize image height Pixel_Height / 4 resolution 72
set New_Path to JPEG_Folder & Base_Name & "_25.jpg"
save Doc_Ref in file New_Path as JPEG with options {quality:6, embed color profile:true} with copying
close without saving
end tell
end tell
end timeout
end tell
end repeat
end
tell application "Adobe Photoshop CS3"
set ruler units of settings to User_Rulers
end tell
on getBaseName(fName)
set baseName to fName
repeat with idx from 1 to (length of fName)
if (item idx of fName = ".") then
set baseName to (items 1 thru (idx - 1) of fName) as string
exit repeat
end if
end repeat
return baseName
end getBaseName
tell application (path to frontmost application as Unicode text)
display dialog "Beelden zijn verwerk" buttons {"OK"} default button 1
end tell