2017-03-18 17:34:12 +01:00
Guetzli is a Google program to optimize JPEG images. Unfortunately, it only works one file at a time. With this script in Python you can do it recursively a whole folder.
2018-01-09 23:39:41 +01:00
## Image optimized with **guetzli-recursively**
![after and before ](demo.jpg )
< a style = "background-color:black;color:white;text-decoration:none;padding:4px 6px;font-family:-apple-system, BlinkMacSystemFont, "San Francisco", "Helvetica Neue", Helvetica, Ubuntu, Roboto, Noto, "Segoe UI", Arial, sans-serif;font-size:12px;font-weight:bold;line-height:1.2;display:inline-block;border-radius:3px;" href = "https://unsplash.com/@senjuti?utm_medium=referral&utm_campaign=photographer-credit&utm_content=creditBadge" target = "_blank" rel = "noopener noreferrer" title = "Download free do whatever you want high-resolution photos from Senjuti Kundu" > < span style = "display:inline-block;padding:2px 3px;" > < svg xmlns = "http://www.w3.org/2000/svg" style = "height:12px;width:auto;position:relative;vertical-align:middle;top:-1px;fill:white;" viewBox = "0 0 32 32" > < title > unsplash-logo< / title > < path d = "M20.8 18.1c0 2.7-2.2 4.8-4.8 4.8s-4.8-2.1-4.8-4.8c0-2.7 2.2-4.8 4.8-4.8 2.7.1 4.8 2.2 4.8 4.8zm11.2-7.4v14.9c0 2.3-1.9 4.3-4.3 4.3h-23.4c-2.4 0-4.3-1.9-4.3-4.3v-15c0-2.3 1.9-4.3 4.3-4.3h3.7l.8-2.3c.4-1.1 1.7-2 2.9-2h8.6c1.2 0 2.5.9 2.9 2l.8 2.4h3.7c2.4 0 4.3 1.9 4.3 4.3zm-8.6 7.5c0-4.1-3.3-7.5-7.5-7.5-4.1 0-7.5 3.4-7.5 7.5s3.3 7.5 7.5 7.5c4.2-.1 7.5-3.4 7.5-7.5z" > < / path > < / svg > < / span > < span style = "display:inline-block;padding:2px 3px;" > Senjuti Kundu< / span > < / a >
2017-04-20 01:23:49 +02:00
**UPDATE** [GUI for Mac OS ](https://github.com/tanrax/guetzli-recursively-gui )
2017-03-18 17:34:12 +01:00
# Install
Guetzli must be installed on your system. Follow the official instructions.
[Guetzli ](https://github.com/google/guetzli )
2017-05-08 10:58:24 +02:00
and 2.7.10 or Python 3.
2017-03-18 17:34:12 +01:00
2017-10-29 20:42:13 +01:00
After
```bash
pip3 install guetzli-recursively
```
2017-03-18 17:34:12 +01:00
# Use
```bash
2017-10-29 20:42:13 +01:00
guetzli_recursively [folder]
2017-03-18 17:34:12 +01:00
```
2017-03-18 17:38:20 +01:00
## Example
2017-03-18 17:34:12 +01:00
```bash
2017-10-29 20:42:13 +01:00
guetzli_recursively img/
2017-03-18 17:34:12 +01:00
```
2017-03-18 17:38:20 +01:00
out
2017-03-18 17:37:05 +01:00
```bash
img/tasks.jpg
Save 6%
img/portfolio/idecrea/space.jpg
It is not necessary to optimize
img/portfolio/home.jpg
Save 3%
```
2018-01-05 16:28:24 +01:00
# Quality
Must be greater than or equal to 84.
```bash
guetzli_recursively --quality 85 img/
```