Automate Croping Pictures for 400 Pictures, how can i do that with AppleScript

Talk about Pixelmator Pro, share tips & tricks, tutorials, and other resources.
User avatar

2022-04-04 09:06:05

Hello All,

how can I automate this? I have about 400 pictures in different sizes and for an automated display I would like to have a section of them in the size 550 * 250 pixels. Manually I can load each image and drag the rectangle (550*250) to the appropriate areas and then crop accordingly. How can I do this automatically with the ML algorithm in an AppleScript?

Many thanks for the help
User avatar

2022-04-04 13:46:22

Hi Holger, I'd use Shortcuts for this, actually – it seems we haven't exposed ML Crop in AppleScript, but there's a Shortcuts action for it. In fact, I had to do exactly the same thing this weekend (except I had to crop about 40 images to a 280x280 square), so I happen to have a shortcut that does this. I've adapted it for you and here's what the actions look like:

Image

Right now, it exports the images to JPEG at max quality, so you'll probably want to adapt that, perhaps preserving the original format.

Note that this shortcut is a Quick Action, so you can use it in the Finder just by selecting all the images, Control-clicking one and choosing Quick Actions, then this action. You can see a little more info about quick actions in one of our recent tutorials here.

And finally, you can download the shortcut itself by clicking here.
User avatar

2022-04-04 17:31:11

Wow, thanks! The support from you at Pixelmator is fantastic!!!
User avatar

2022-04-04 18:44:32

by Holger Gelhausen 2022-04-04 14:31:11 Wow, thanks! The support from you at Pixelmator is fantastic!!!
Cheers, glad I could help! :raised_hands:
User avatar

2022-04-05 17:00:02

The Shortcuts works also very well with Command Line. Bildzu550 my Name of the Shortcut. i - input file -o output file.

Command Line:

shortcuts run Bildzu550 -i "/P_PlayingGames/ia_100000014067.jpeg" -o /P_PlayingGames/ia_100000014067--.jpeg

I trigger with Keyboard Maestro!

Thanks
User avatar

2022-04-05 17:00:51

The Shortcuts works also very well with Command Line.
Bildzu550 my Name of the Shortcut. i - input file -o output file.

Command Line:

shortcuts run Bildzu550 -i /P_PlayingGames/ia_100000014067.jpeg -o /P_PlayingGames/ia_100000014067--.jpeg

I trigger with Keyboard Maestro!

Thanks