Jump to content

Make Pixelmator open a file, resize, and compress it?


Recommended Posts

Posted

I've been using Pixelmator for photo editing and just bought the power pack (finally). Would LOVE to be able to create a workflow where Alfred would automatically take a downloaded photo and resize it to a specific width (600px ?) and also compress it (to like 80% export or whatever- like Pixelmator does) so that the photo is automatically ready for web upload...

 

Do you have thoughts on how to best do that? It doesn't have to be Pixelmator by the way, I just already have that program on my comp...

 

Thanks for any help and advice!!!!

Posted (edited)

Hi @Ray Porrello, welcome to the forum.

 

This isn't really an Alfred question, tbh. You can use Alfred to choose the image(s) you want to resize, but it can't do any image processing itself.

 

You need to write a script to do your image processing, and then run it with Alfred. We can help with the second part, but there are probably better places to get help with the first (the Pixelmator forum, AskDifferent etc.).

 

I can point you at the macOS tool sips or GraphicsMagick if you have Homebrew, and I think Automator can resize images, too. But I've no idea if they produce particularly good results.

 

As far as Pixelmator goes, I think only the pro version is scriptable. The regular version does have some Automator actions that might be able to do what you want.

Edited by deanishe
  • 1 year later...
Posted

Hi. I am starting to learn how to harness some of the power of Alfred and having some automation for image manipulation via Pixelmator Pro is something I am wanting to do. I know that the Apple Shortcuts can access some Pixelmator functions and a Shortcut can be called from Alfred so this is what I will play with. I hope this helps.

Posted (edited)

Apple shortcuts is a dumpster fire! I have this working automator workflow that duplicates and renames an image, resizes to 50% and then compresses it using the wonderful app imageoptim (note though I own pixelmator pro and it has equivalent actions but I wanted this to use the built-in apple functions):

image.png.2e93cd260c07f16d4fc9fb1b103cb434.png

 

This works great. Trying to do the same in Apple Shortcuts just fails. First you cannot copy and rename a file without manually entering a folder, disrupting the automation. Then the saved file is not actually modified by the resize action, and there is no logging or error messages to tell you what is going wrong. Finally Shortcuts does not include the Pixelmator pro actions at all yet.

 

I also wanted to try to do this directly in Alfred, but the automations are not yet capable of doing this either (for example resize actions don't accept percentages etc.).

 

 

 

Edited by iandol
Posted
18 hours ago, iandol said:

Then the saved file is not actually modified by the resize action, and there is no logging or error messages to tell you what is going wrong.

 

Technically the action (probably) worked, it’s just that Shortcuts copied the image to a temporary location and resized it there. It’s weird, yes, but you can verify it by going into the temporary files location and seeing the images appear and disappear there. It can indeed get quite confusing.


If you make the Shortcut and tell it to accept input files, then pass the files via Alfred to Run macOS Shortcuts, it should work (depending on how the Workflow is set up).

 

18 hours ago, iandol said:

for example resize actions don't accept percentages

 

It’s useful to know when there’s something you want from an Automation Task that is missing. Some Tasks on the list have been prioritised due to specific requests and others had features added for the same reason.

 

I’ve now added an Automation Task to Resize Image by Percentage. It will be in by the next release, which should come in the next few days. I’m currently adding/testing other unrelated Tasks and they will all ship at the same time.

Posted
On 8/4/2022 at 3:49 AM, vitor said:

I’ve now added an Automation Task to Resize Image by Percentage. It will be in by the next release, which should come in the next few days.

 

2022.9 is out with the new AT.

Posted
19 hours ago, vitor said:

 

2022.9 is out with the new AT.

 

Thank you vitor!!! Shortcuts should try to work similar to automator, it seems obvious when chaining actions together that you want to work on the output of the previous action to me. Temporary files break the chain for no clear purpose. Shortcuts provides no log, no feedback. I honestly cannot understand how Apple's numerous well paid developers cannot do provide some clear log like Alfreds wonderful debug panel of what is going on. 

 

So I wanted to build a workflow only with automation blocks, select a png file, make a copy, then resize it. However the output of the automation item "Duplicate paths" does not return the file names, so a simple chain like:

 

image.png.8dbd94d2d7cca6df9c19f7c5b698bd07.png

 

...doesn't work. I imagine I can copy the original file name to a variable then recreate the copy name (2 is appended AFAICT), to send to the resize action, but it would be nice to be able to just chain these without a lot of intermediate processing. If "Duplicate" could output the resultant paths, could this chain then work as desired? 

Posted
3 hours ago, iandol said:

If "Duplicate" could output the resultant paths, could this chain then work as desired?

 

It should, yes. The change to Duplicate will come in the next release.

Posted
18 hours ago, vitor said:

 

It should, yes. The change to Duplicate will come in the next release.

 

Thanks Vitor, you are leagues above the automation team at Apple!!!

Posted
On 8/7/2022 at 4:33 PM, vitor said:

Made a smaller release with this change and another Finder-related addition (getting selection).

 

Confirms this now works great, copies the image, resizes it 50% then ships it to ImageOptim to compress it:

 

image.png.5da2bcc881b2ae341d7a5ee4c524f255.png

 

 

 

  • 4 months later...
  • 3 weeks later...
Posted

Hi Vitor,

Thanks for the explanation. I have created the workflow and added a hotkey; it works great! 

 

If I don't add the hotkey, how would I activate this workflow?

 

image.thumb.png.9c6b5b39f9cce57239c069927a0e4e72.png

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...