dotjay Posted February 7, 2018 Share Posted February 7, 2018 For anybody who wants the image file to save as a new file rather than replace the original: Open the "Process image(s)" AppleScript block in the workflow Find this line in the script: save this_image in myPath And insert the following to append the image filename with the target width (e.g. image.png becomes image-300.png when resized to 300px width): -- append target width to file name set oldDelim to AppleScript's text item delimiters set AppleScript's text item delimiters to {"."} set theExt to last text item of myPath set AppleScript's text item delimiters to {"." & theExt} set file_path_list to every text item of myPath set AppleScript's text item delimiters to {"-" & target_width & "." & theExt} set myPath to the file_path_list as string set AppleScript's text item delimiters to oldDelim joeynotjoe and gandalfsaxe 2 Link to comment
MrStreeter Posted November 1, 2018 Share Posted November 1, 2018 (edited) I needed a workflow that put the resized images into a sub folder of the originals, so made the following amendments. It can handle multiple file selections within differing directories and place the resize-x folder within the respective directory relative to the original image. Open the "Process image(s)" AppleScript block in the workflow Find the following lines in the downloadable version (Lines 27-28) set myPath to this_file end if And insert the following after it that will create a new directory next to the file being resized in the format of 'resize-{resize-width}' (resize-500, resize-1024 for example) -- Remove the file name from the end of the path string set filePath to characters 1 thru -((offset of "/" in (reverse of items of myPath as string)) + 1) of myPath as text set fileName to name of (info for myPath) -- Create a full path to the folder that we want. set resizeFolderName to ((filePath as text) & "/resize-" & (target_width as text) & "/") as text -- Check for the resize-x folder and create it if not present if folderExists(resizeFolderName) then set outputFolder to resizeFolderName else set createThisFolder to POSIX file filePath as alias tell application "Finder" to make new folder in createThisFolder with properties {name:"resize-" & target_width} set outputFolder to resizeFolderName end if Change the following line (Originally on line 38, with the addition of the above, its now on line 60) save this_image in myPath to save this_image in outputFolder & fileName Add the following function to the end of the file: on folderExists(theFolder) tell application "Finder" try set thisFolder to the POSIX path of theFolder set thisFolder to (POSIX file thisFolder) as text -- set thisFolder to theFolder as alias return true on error err return false end try end tell end folderExists Or, if you want the whole script in one thing, its on a Gist here: https://gist.github.com/danstreeter/23fe01074034832fec09c0b633522559 Edited November 1, 2018 by MrStreeter Correct Gist link Link to comment
dodo2 Posted November 7, 2019 Share Posted November 7, 2019 Hi - this workflow working perfect with macos 10.14 but stop working on Catalina 10.15. I got always error ( can't get item 1 of {} )- anybody have any idea what is wrong ? Thnaks for any sugestions. Link to comment
Davejorg Posted January 10, 2020 Share Posted January 10, 2020 On 11/7/2019 at 11:59 AM, naymapl said: Hi - this workflow working perfect with macos 10.14 but stop working on Catalina 10.15. I got always error ( can't get item 1 of {} )- anybody have any idea what is wrong ? Thnaks for any sugestions. I get the same issue. Any suggestions? Link to comment
Acidham Posted January 11, 2020 Author Share Posted January 11, 2020 Seems to be an issue with Image Events under Catalina: https://forums.developer.apple.com/thread/124420 To fix there is a simple solution: https://darjeelingsteve.com/articles/Fixing-"Image-Events"-AppleScripts-Broken-in-macOS-10.15-Catalina.html Quote These problems appear to be caused by Image Events not having Full Disk Access permissions. Fortunately it's an easy fix. First, launch System Preferences and navigate to the Security and Privacy pane. Click the Privacy tab, scroll down the menu on the left, and click on Full Disk Access. Click the + icon in the right hand box, and navigate to System > Library > Core Services. Select Image Events, and click the Open button. nicola.efflandrin, zz379 and IOIO 3 Link to comment
IOIO Posted August 28, 2020 Share Posted August 28, 2020 On 1/11/2020 at 10:25 AM, Acidham said: Seems to be an issue with Image Events under Catalina: https://forums.developer.apple.com/thread/124420 To fix there is a simple solution: https://darjeelingsteve.com/articles/Fixing-"Image-Events"-AppleScripts-Broken-in-macOS-10.15-Catalina.html Great! Thank you very much! Works! 👍 This should be added to the description of the workflow to make it work! Link to comment
jen Posted October 20, 2020 Share Posted October 20, 2020 (edited) On 1/11/2020 at 5:25 PM, Acidham said: Seems to be an issue with Image Events under Catalina: https://forums.developer.apple.com/thread/124420 To fix there is a simple solution: https://darjeelingsteve.com/articles/Fixing-"Image-Events"-AppleScripts-Broken-in-macOS-10.15-Catalina.html Can't find the core services folder and image event (System > Library > Core Services) in the latest macOS system (10.15.7), is there any new solution? I rely on this workflow a lot, please help… 😭🙏 Thanks very very very much! Edited October 20, 2020 by jen attach image Link to comment
Acidham Posted October 20, 2020 Author Share Posted October 20, 2020 1 hour ago, jen said: Can't find the core services folder and image event (System > Library > Core Services) in the latest macOS system (10.15.7), is there any new solution? I rely on this workflow a lot, please help… 😭🙏 Thanks very very very much! It is there! But why are you looking up for ImageEvents.app in Alfred!? You need to add it to System Preferences → Full Disk Access and click on the + to add it. With this Finder will open Link to comment
deanishe Posted October 20, 2020 Share Posted October 20, 2020 5 hours ago, jen said: System > Library > Core Services In your screenshot, you’re looking in /Library, not in /System/Library. swiggy 1 Link to comment
swiggy Posted October 30, 2020 Share Posted October 30, 2020 Hi does this workflow only work with the same height and width? for example 1080 x 1080? How can change it 1080 x 580 for example? Link to comment
Acidham Posted October 30, 2020 Author Share Posted October 30, 2020 2 hours ago, swiggy said: Hi does this workflow only work with the same height and width? for example 1080 x 1080? How can change it 1080 x 580 for example? Your usecase describes cropping but the workflow was build to resize an image. Therefore the answer to your question is no. please also read the usage Description: Usage Select an image in Finder, open Alfred and enter rimage and enter a value for the target width, e.g. rimage 300. The image will be resized to target width by respecting ratio. Works with .jpg and .png. Link to comment
swiggy Posted October 30, 2020 Share Posted October 30, 2020 ah, thanks, is there any workflow that u know that will be able to adjust width and height at different values ? Link to comment
deanishe Posted October 30, 2020 Share Posted October 30, 2020 3 hours ago, swiggy said: Hi does this workflow only work with the same height and width? for example 1080 x 1080? Are you asking if it only works with square images? Link to comment
swiggy Posted October 31, 2020 Share Posted October 31, 2020 Im looking to resize other than a square image which this seems to only do that. Link to comment
deanishe Posted October 31, 2020 Share Posted October 31, 2020 The description says it preserves aspect ratio, so it should work with any image. Link to comment
Coffeee Posted December 6, 2020 Share Posted December 6, 2020 hello, have error : "fails to obtain item 1 of {}" picture how can i fix it ? Link to comment
Acidham Posted December 7, 2020 Author Share Posted December 7, 2020 On 1/11/2020 at 10:25 AM, Acidham said: Seems to be an issue with Image Events under Catalina: https://forums.developer.apple.com/thread/124420 To fix there is a simple solution: https://darjeelingsteve.com/articles/Fixing-"Image-Events"-AppleScripts-Broken-in-macOS-10.15-Catalina.html Have you tried that? Link to comment
Le Tien Posted January 18, 2022 Share Posted January 18, 2022 Not working on Big Sur m1 Link to comment
Vero Posted January 18, 2022 Share Posted January 18, 2022 50 minutes ago, Le Tien said: Not working on Big Sur m1 Please be more specific rather than simply saying "not working" * What you were doing when the issue happened * Whether you were able to replicate it a second time by performing the same action * Include any screenshots that might help us * For a workflow, check the workflow debugger for any error messages that could be helpful * Include the Alfred version & build number you are using (don't say "latest" - you'll find a version number in the Update tab of Alfred's preferences) * Include your macOS version The clearer the issue report, the more likely and easily we'll be able to help you resolve it. Le Tien 1 Link to comment
stylophile Posted February 3, 2022 Share Posted February 3, 2022 (edited) On 1/11/2020 at 1:25 AM, Acidham said: Seems to be an issue with Image Events under Catalina: https://forums.developer.apple.com/thread/124420 To fix there is a simple solution: https://darjeelingsteve.com/articles/Fixing-"Image-Events"-AppleScripts-Broken-in-macOS-10.15-Catalina.html I'm running Monterey 12.2 and this fix worked for me. Thanks @Acidham, for making this script, I find it very useful! You could probably even update the compatibility matrix on Packal as I can confirm it works in every version up through Monterey, and maybe add the fix in the Usage section for people downloading it the first time so they're not scratching their heads as to why it's not working. Edited February 3, 2022 by stylophile Link to comment
Acidham Posted February 3, 2022 Author Share Posted February 3, 2022 Thank you @stylophile for the feedback. The stopped using packal. I am not even able to find the workflow because packal search is broken Furthermore, packal does not provide checkboxes for newer versions of macos. For me, it looks like that packal is not being maintained anymore :/ stylophile 1 Link to comment
vitor Posted February 4, 2022 Share Posted February 4, 2022 14 hours ago, Acidham said: For me, it looks like that packal is not being maintained anymore Correct. It hasn’t been maintained for a while despite staying up. The official place to share Workflows is this forum. Nonetheless, the effect of Packal was large enough that it continues to be used and get submissions, despite features breaking. Link to comment
snoop182 Posted February 13, 2022 Share Posted February 13, 2022 On 1/11/2020 at 11:25 AM, Acidham said: Seems to be an issue with Image Events under Catalina: https://forums.developer.apple.com/thread/124420 To fix there is a simple solution: https://darjeelingsteve.com/articles/Fixing-"Image-Events"-AppleScripts-Broken-in-macOS-10.15-Catalina.html Hello, 12.2.1 m1, this fix worked for me, thx Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now