EN
Bash - compress svg file
4
points
In this short article we want to show how to reduce *.svg
file size using svgo
command (SVG Optimizer) in Bash or Windows Command Prompt. Motivation to optimize svg files is web development where we need to provide small file sizes to speed up page loading.
Quick solution (use following command):
svgo logo.svg
Output:
logo.svg:
Done in 60 ms!
6.365 KiB - 25% = 4.771 KiB
Where:
25%
indicates how much file size was reduced,6.365 KiB
is file size before optimization,4.771 KiB
is file size after optimization.
Note: by default
svgo
overwrites exiting file with optimal version.
svgo
instalation example
To install svgo
it is necessary to do few steps:
- be sure that NodeJS is installed (instalation instruction for Windows is avaialble here),
- install
svgo
with following command:npm install -g svgo
- now we can use
svgo
command (go back to Quick solution).