Languages
[Edit]
EN

Bash - compress svg file

4 points
Created by:
Root-ssh
66587

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:

  1. be sure that NodeJS is installed (instalation instruction for Windows is avaialble here),
  2. install svgo with following command:
    npm install -g svgo
  3. now we can use svgo command (go back to Quick solution).

References

  1. svgo - npm 
Native Advertising
50 000 ad impressions - 449$
ūüöÄ
Get your tech brand or product in front of software developers.
For more information contact us:
Red dot
Dirask - friendly IT community for everyone.

‚̧ԳŹūüíĽ ūüôā

Join