-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from NathanJPlummer/master
Add adjustable options and update README.
- Loading branch information
Showing
2 changed files
with
88 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,43 @@ | ||
# Introduction | ||
|
||
Guetzling is a simple script for macOS and Linux written in Bash, to automate (recursively finding files) the compression of jpegs using the Guetzli algorithm. | ||
Guetzling is a simple script for macOS and Linux written in Bash to automate (recursively finding files) the compression of JPGs and PNGs using the Guetzli algorithm. | ||
|
||
## Install | ||
1. Install [Guetzli](https://github.com/google/guetzli), and copy it to an executable folder (`/usr/bin` for example), if it's not already there. | ||
2. Copy Guetzling, copy it to `/usr/bin` or something like that. | ||
By design, Guetzling will overwrite and/or delete your original files. If you want to keep your originals, make a backup of your folder before using Guetzling. | ||
|
||
## Install Guetzli | ||
1. Install [Guetzli](https://github.com/google/guetzli), via the directions provided at the link. | ||
2. Copy Guetzling, copy it to `/usr/bin`. | ||
|
||
## Usage | ||
1. Simply `cd` to the parent directory of your choice, and `guetzling`. ***Voilà!*** | ||
1. Simply `cd` to the parent directory of your choice, and `guetzling`. ***Voilà!*** | ||
|
||
## Adjustable Options | ||
|
||
By opening the script in a text editor, you can adjust certain variables to change the output of Guetzling. | ||
|
||
### JPG | ||
|
||
Enable/Disable re-compression of JPG and JPEG files using Guetzling. | ||
|
||
#Recompress JPG Images | ||
#Set to false to disable | ||
JPG=true | ||
|
||
### PNG | ||
|
||
Enable/Disable the conversion of PNG to JPG using Guetzling. | ||
|
||
#Convert PNG Images | ||
#Set to false to disable | ||
#PNGS WILL BE DELETED AFTER CONVERSION | ||
PNG=true | ||
|
||
### QUALITY | ||
|
||
Change Guetzling/Guetzli Quality Level. | ||
|
||
#Set Quality level | ||
#Default = 95 | ||
#Max = 100 | ||
#Min = 84 | ||
QUALITY=95 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,53 @@ | ||
#!/bin/bash | ||
|
||
#Recompress JPG Images | ||
#Set to false to disable | ||
JPG=true | ||
|
||
#Convert PNG Images | ||
#Set to false to disable | ||
#PNGS WILL BE DELETED AFTER CONVERSION | ||
PNG=true | ||
|
||
#Set Quality level | ||
#Default = 95 | ||
#Max = 100 | ||
#Min = 84 | ||
QUALITY=95 | ||
|
||
IFS=$'\n'; | ||
FOLDER=$(pwd) | ||
for f in $(find "$FOLDER" -name '*.jpg') | ||
#for f in $1/*.jpg | ||
do | ||
echo "Guetzling file - $f..." | ||
guetzli -quality 95 "$f" "$f" | ||
echo "Done." | ||
done | ||
|
||
if [ $JPG = true ]; | ||
then | ||
for f in $(find "$FOLDER" -name '*.jpg') | ||
#for f in $1/*.jpg | ||
do | ||
echo "Guetzling file - $f..." | ||
guetzli --quality "$QUALITY" "$f" "$f" | ||
echo "Done." | ||
done | ||
fi | ||
|
||
if [ $JPG = true ]; | ||
then | ||
for f in $(find "$FOLDER" -name '*.jpeg') | ||
#for f in $1/*.jpeg | ||
do | ||
echo "Guetzling file - $f..." | ||
guetzli --quality "$QUALITY" "$f" "$f" | ||
echo "Done." | ||
done | ||
fi | ||
|
||
if [ $PNG = true ]; | ||
then | ||
for f in $(find "$FOLDER" -name '*.png') | ||
#for f in $1/*.png | ||
do | ||
echo "Guetzling file - $f..." | ||
guetzli --quality "$QUALITY" "$f" "${f%.png}.jpg" | ||
rm "$f" | ||
echo "Done." | ||
done | ||
fi |