Monday, May 25, 2020

#1 2020-05-21 01:47:09 pm

Fredrik71
Member
Registered: 2019-10-23
Posts: 261

Script Editor Snippet

There has been many topic in this forum about resize images or manipulate image of some kind.

What maybe is not clear for some people, Apple include snippet to manipulate image in
Script Editor.

If you open this script in Script Editor.

Applescript:

tell application "Finder"
   set theItem to get selection
   set thePath to POSIX path of (theItem as text)
end tell

Now you will select the variable ---> thePath
next
ctrl + mouse click (contextual menu)
next
In the menu you have ---> Image Manipulation
next
Select Resize and a display dialog will open to ask for input.
next
Now you will have code to manipulate the image you have selected in finder.

If the manipulation tools do not include what you want, why not check the code from Apple
and update it or make some new snippets.

To be honest this was really new to me... or in other words I have never use it before.
So I though maybe there are more people like me who do not know.

Applescript:

tell application "Finder"
   set theItem to get selection
   set thePath to POSIX path of (theItem as text)
end tell

tell application "Image Events"
   set this_image to open thePath
   rotate this_image to angle -90
   save this_image in thePath
   close this_image
end tell

Applescript:

tell application "Finder"
   set theItem to get selection
   set thePath to POSIX path of (theItem as text)
end tell

tell application "Image Events"
   set this_image to open thePath
   rotate this_image to angle 90
   save this_image in thePath
   close this_image
end tell

Applescript:

tell application "Finder"
   set theItem to get selection
   set thePath to POSIX path of (theItem as text)
end tell

tell application "Image Events"
   set this_image to open thePath
   scale this_image to size 1024
   save this_image in thePath
   close this_image
end tell

Applescript:

tell application "Finder"
   set theItem to get selection
   set thePath to POSIX path of (theItem as text)
end tell

tell application "Image Events"
   set this_image to open thePath
   scale this_image by factor 0.5
   save this_image in thePath
   close this_image
end tell

Regards.

Last edited by Fredrik71 (2020-05-21 01:49:33 pm)


I  have skied the highest mountain without logic, and still its the imagination that take me anywhere. Its the desire of something that matters for any knowledge I have or could learn.

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)