Created
October 14, 2024 18:59
-
-
Save stoph/1611f19a63b9ebb1d9813eee7151b8df to your computer and use it in GitHub Desktop.
Compress PNG Finder Automation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for f in "$@" | |
| do | |
| # Get the base name of the file without the extension | |
| base_name=$(basename "$f" .png) | |
| # Get the directory where the file is located | |
| dir_name=$(dirname "$f") | |
| # Create a backup with the ".org.png" extension | |
| cp "$f" "$dir_name/$base_name.org.png" | |
| # Compress the original image | |
| /opt/homebrew/bin/pngquant --force --ext .png "$f" | |
| done |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Step 1: Install pngquant
Step 2: Create an Automator Quick Action
Step 3: Add the Shell Script Action
Step 4: Save the Quick Action
Step 5: Test the Quick Action