This article describes how I use docker to optimize my own image files.
Directly shrink the image files in the directory, and optimize the graphics with one line of command.
This is the repo I created on GitHub, download it and build your own image to use it
Please note that the original image will be changed directly!!
https://github.com/DevinY/optimize-image
Build your own image can use the following commands:
docker build -t optimize-image .
I use this command to update image files with text content
docker run --rm -v ${PWD}:${PWD} optimize-image ${PWD} -mw 900 -q 80
Please note that you have a backup of the original image, I use this command to update the super large pattern on my website
docker run -rm -v ${PWD}:${PWD} optimize-image ${PWD} -mw 1620 -q 20
actual operation screen
Before the start, there are 3.9M and 3.8M. The following are the pictures before the update
The moment of witnessing the miracle, after execution
docker run -v ${PWD}:${PWD} optimize-image ${PWD} -mw 1620 -q 20
The result after performing optimization is directly less40MB, the picture file is reduced to a few Hundred KB.

No Comment
Post your comment