If you want to convert pictures using Guetzli but you don’t want to install all progams and libraries, you can use the following script. The script will execute a Docker container in which Guetzli and all it’s dependencies are installed. All pictures that are handed over while executing the script will be processed and put out after the process has finished.
My contribution was only the script. The Docker image was already available on the Docker Hub.
In the following steps I will give a short description on how to use the script.
To use the script, you first have to download it.
git clone https://github.com/bjarneeins/guetzlidocker.git
The first method is to only pass a single picture to the script for execution.
bash guetzlidocker.sh /home/user/Bilder/1234.jpg
This will result in the picture named “1234.jpg” being converted.
To convert several pictures at once, the following method can be used.
bash guetzlidocker.sh /home/user/Bilder/*
This will convert all pictures in the directory /home/user/Bilder/.
While the pictures are being processed you can monitor the resource usage using htop.
With both methods, the original files will remain in the directory alongside with the new converted pictures which have the ending _guetzli.
To have a relatively small file as result after converting, I have set the quality to 85%. To achieve a higher output quality, the parameter “–quality” in the script has to be changed.
docker run --rm -it -v "$(pwd):/work" -w /work icedream/guetzli \
--quality 85 $file $guetzlifile
Source of preview picture:
By Google Inc. – https://github.com/google/guetzli/blob/master/guetzli.svg
Apache License 2.0, https://commons.wikimedia.org/w/index.php?curid=64502252