Renaming an image file according to its dimensions
Hey everyone. I'm fairly new to Applescript, but I'm working hard to try and pick it up. However, I'm having an absolute nightmare with something that I would have thought would be relatively simple.
I have built an Automator workflow which could potentially save me hours in my day to day job, but there's just one step that I cannot get to work. All I need is to be able to feed in a bunch of image files and have them renamed according to their dimensions (for example - 'pictureofadog.jpg' is 100 pixels wide by 50 pixels high so it gets renamed as '100x50.jpg'. That's literally all I need.
Automator has actions to let you filter by all kinds of different criteria but height and width aren't included. I know I'll be able to use a 'Run AppleScript' action to make this happen but am really struggling. Another Redditor very helpfully pointed me towards ImageEvents (specifically this page: http://macosxautomation.com/applescript/imageevents/01.html), which has enabled me to get really close and return the height and width of a single image as a string, but I just can't get past that point.
Apologies if I'm being a bit thick but I'm losing my mind over this and any help would be GREATLY appreciated!
Posted Jun 16, 2017, 7:49 PM UTC