I have tried using a service in automator
that receives pdfs files to scale them and added cut to clipboard step but I can’t seem to have it working for me.
I don’t know how to access the script itself and my mac simply tells me there’s an error.
I’d like to click on a pdf, jpg, png, etc and have it scaled to thumbnail size to insert it in Outlook.
Can someone point me to a good resource?
I am pretty handy with bash, js and applescript.
FreddieMac. I do not completely understand what your are requesting, but the script contained below reduces the pixel size of an image file. As written, it reduces the greater of the width or height of the image file to the specified targetImageSize. The sips man page details other resize options. I tested this with JPG, PNG, and PDF image files and it worked as expected.
set targetImageSize to 100
set sourceFile to POSIX path of (choose file)
-- Alternative that works on file selected in the Finder
-- tell application "Finder" to set sourceFile to selection as alias
-- set sourceFile to POSIX path of sourceFile
set TID to AppleScript's text item delimiters
set AppleScript's text item delimiters to "/"
set filePath to text 1 thru text item -2 of sourceFile & "/"
set fileName to text item -1 of sourceFile
set AppleScript's text item delimiters to TID
set targetFile to filePath & "ThumbNail - " & fileName
do shell script "sips --resampleHeightWidthMax " & targetImageSize & " " & quoted form of sourceFile & " --out " & quoted form of targetFile
This does work wonderful, except I would like to retain the original files.
My idea is to context-menu mouse-click on the image(pdf, jpg, tiff, etc). Have it create a lowres version. Send it to the clipboard in order to paste into an outlook email as a thumbnail.
I know I can probably patch it up here and there. I just thought someone may have inquired on this already?
Alternative workaround. You can play with clipboard yourself. I don’t understand completely what you need, because I uninstalled Outlook from my Mac:
-- set aFile to (the clipboard as «class furl»)
set aFile to (choose file of type "public.image") as «class furl»
set newFile to (choose file name)
tell application "Image Events"
set anImage to open aFile
scale anImage to size 100
save anImage as TIFF in newFile with icon
-- set the clipboard to anImage
NOTE: full disk access required for the Image Events.app. So, give it.
I’ll cobble it up best I can.
I’m sure I am doing something wrong.
Thank you for this wonderful forum.
I appreciate the contributions made for us newbies to learn.
I love applescript.
I love macscripter!