Jump to content

Reduce size of JPEG/PNG file


Recommended Posts

This workflow has no dependencies. It does make use of Automation Tasks so make sure your Automation Tasks are up to date!

 

The workflow, which works as a Universal Action on a single, selected JPEG or PNG file:

  • saves the original image in a temporary folder specified in the User Configuration;
  • resizes the image file to the default longest side measurement specified in the User Configuration (measured in pixels);
  • optionally allows saving of the resized image to the clipboard;
  • at the end of the workflow provides an option to delete the saved original image.


Note: The workflow does not enlarge images that already have a shorter longer side than specified in the User Configuration.

Usage
Select a single JPEG or PNG file in Finder, use your Universal Actions hotkey and choose Reduce size of JPEG/PNG file to run the workflow.

 

SelectedFile.thumb.png.5cec9b8a4b8d5eb678ba03dc9fda524c.png

You can download the workflow from Github.

 

Stephen

Edited by Stephen_C
Corrected link. Then REALLY corrected link!
Link to comment
1 hour ago, TomBenz said:

Hi Stephen, please re-check the link. It says not found.

Hmm - apologies. The link I inserted - and the edited link - work for me. Give me a little time and I'll try to find out what is wrong. In the meantime this link should take you directly to the v1.0 release.

 

Sorry tor the inconvenience.

 

Stephen

Link to comment

The original link is now corrected. So far as I can see, I inserted the correct link but the forum software appeared to be adding a rogue space on the middle of the link. In any event the original link should now work.

 

Edit: It might well have been an issue my end!

 

Stephen

Edited by Stephen_C
Clarification.
Link to comment

I could download and tried it. I get following in debugger log:

 

[15:34:45.430] Reduce size of JPEG/PNG file[File Action] Processing complete
[15:34:45.438] Reduce size of JPEG/PNG file[File Action] Passing output '/Users/pankajzawar/Downloads/0O9A0531.JPG' to Arg and Vars
[15:34:45.440] Reduce size of JPEG/PNG file[Arg and Vars] Processing complete
[15:34:45.442] Reduce size of JPEG/PNG file[Arg and Vars] Passing output '/Users/pankajzawar/Downloads/0O9A0531.JPG' to Automation Task
[15:34:45.444] Reduce size of JPEG/PNG file[Automation Task] Running task 'Copy Path With the Finder' with arguments (
    "/Users/pankajzawar/Downloads/0O9A0531.JPG"
)
[15:36:18.533] ERROR: Reduce size of JPEG/PNG file[Automation Task] Task Error: /Users/pankajzawar/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/Automation Tasks/e836e59596edda8ea3956180f099e998e541ba3e6eca887b232a9954c0b24252:398:454: execution error: Finder got an error: AppleEvent timed out. (-1712)

 

See if you can help to troubleshoot it.

 

I am on Monterey Ventura 13.1 and also getting this apple event error for simple AppleScript 

tell application "Contacts"

set aPerson to selection

end tell


Not sure if these are related. Alfred version 5.05 [2096]

Link to comment

With apologies for the rapid sequence of releases, but thanks to @vitor for the idea, I have released version 3.0 which now backs up to a tmp folder which is:

  • created if it does not exist;
  • automatically deleted when your Mac restarts.

That means you should not ever be nagged about creating a temporary folder for the backup nor be encumbered with a temporary folder you do not wish to retain.

 

Stephen

Link to comment
  • 4 weeks later...

I have your Alfred workflow installed - seems like great idea and very useful tool.  However, it is not doing anything for me.  I have Alfred 5, and your version 3 of the workflow. I have configured to 500 pixels and identified an originals folder.  However, when I pick an image file, and action the workflow app, nothing happens...literally.  There's no error message, no flashing lights, no file created or moved into folder...nothing.  Any advice or trouble-shooting you can recommend?  Screen grab shows the file and workflow selected - from there, I press enter, then...nothing.

Screen Shot 2022-12-19 at 4.37.28 PM.png

Edited by alnetloc
To add image and note at end.
Link to comment

Would you please use the debugger utility and post the output here so that I can see the output when you run the workflow. Sorry for the problem but I have tested the workflow using your 500px setting and it does work for me so we need to discover why it's not working for you. Just check the User Configuration again to ensure that you saved the 500px setting (only an idea: sorry if it doesn't help!).

 

Stephen

Link to comment
On 11/28/2022 at 2:24 AM, Stephen_C said:

With apologies for the rapid sequence of releases, but thanks to @vitor for the idea, I have released version 3.0 which now backs up to a tmp folder which is:

  • created if it does not exist;
  • automatically deleted when your Mac restarts.

That means you should not ever be nagged about creating a temporary folder for the backup nor be encumbered with a temporary folder you do not wish to retain.

 

Stephen

Hi Stephen, is it possible to update the workflow to process multiple image files together instead of one? thanks in advance

Link to comment

That is in theory possible but it rather messes up parts of the workflow to do so. For example, you can copy only one image to the clipboard at a time. In the circumstances, and because it's rather easy to run the workflow on multiple files by selecting each individually and using the Universal Action hotkey, I hope you'll understand why I don't propose to change the workflow.

 

Stephen

Link to comment
1 hour ago, Stephen_C said:

That is in theory possible but it rather messes up parts of the workflow to do so. For example, you can copy only one image to the clipboard at a time. In the circumstances, and because it's rather easy to run the workflow on multiple files by selecting each individually and using the Universal Action hotkey, I hope you'll understand why I don't propose to change the workflow.

 

Stephen

Thanks Stephen

Link to comment

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...