I would like the enlarged image to keep the same name as the original, and I will use Save As…
Here is the Script:
– Open the Applescript Editor.
– Create a new script and paste the following code:
on open theImages
repeat with anImage in theImages
tell application “Image Events”
–Set the maximum dimension of the picture.
– If it is in landscape mode, it is the width.
– If it is in portrait mode, it is the height.
set the targetSize to 1080
set currentImage to open anImage
set imageType to currentImage’s file type
scale currentImage to size targetSize
tell application “Finder” to set newImage to (container of anImage as string) & " " & (name of anImage)
save currentImage in newImage as imageType
end tell
end repeat
end open
– Save the script as an “Application”.
–Drag your image to the new script Application. You will get a new file with the new dimension.
-- Open the Applescript Editor.
-- Create a new script and paste the following code:
on open theImages
repeat with anImage in theImages
tell application "System Events"
set newImage to (path of container of anImage) & space & name of anImage
end tell
do shell script "cp " & quoted form of POSIX path of anImage & space & quoted form of POSIX path of newImage
tell application "Image Events"
--Set the maximum dimension of the picture.
-- If it is in landscape mode, it is the width.
-- If it is in portrait mode, it is the height.
set the targetSize to 1080
set currentImage to open newImage
set imageType to currentImage's file type
scale currentImage to size targetSize
save currentImage
close currentImage
end tell
end repeat
end open
-- Save the script as an "Application".
--Drag your image to the new script Application. You will get a new file with the new dimension.
As you see, it doesn’t use the Finder and it duplicate the file before asking ImageEvents to apply.
If I remember well you already asked about this script.
We can’t guarantee that ImageEvents will do the job without loss.
In fact, I’m quite sure that you will loose details because doing the job with PhotoShop or The Gimp gives a better result, maybe because they use more recent algorithms.
Yvan KOENIG (VALLAURIS, France) mardi 9 septembre 2014 15:37:21
In the other post, I showed part of the library script from Shane Stanley for enlarging the image. The new image looks pretty good. All you need to do to scale the image is:
Check the image height and width.
Find the ratio of the larger one to your desired scale size.