Languages
[Edit]
EN

Bash - compress svg file

4 points
Created by:
Root-ssh
177500

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 the following command):

svgo image.svg

Output:

image.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

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 using the following command:
    npm install -g svgo
  3. now we can use svgo command (go back to Quick solution).

 

References

  1. svgo - npm 

Alternative titles

  1. Bash - optimize svg file size
  2. Bash - reduce svg file size
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Bash

Bash - compress svg file
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join