📜 ⬆️ ⬇️

Optimization / compression of SVG images

Hello Habr!
The article is devoted to the optimization of SVG format images.



SVG (from English Scalable Vector Graphics - scalable vector graphics) is a scalable vector graphics markup language created by the World Wide Web Consortium (W3C) and included in a subset of the extensible markup language XML, designed to describe two-dimensional vector and mixed vector / raster graphics in XML format .

Instruments


The principle of the application is as follows, they remove the "unnecessary" information from the SVG, thereby reducing the size of the file itself. Today, there are three main applications for optimizing SVG:

Comparison


To compare the results of applications, I took the following image .
')
Picture

Image saved using Adobe Illustrator CS6.

SVG options

Image size - 6,279,219 bytes
applicationResult byteResult%Elapsed time, second
SVG Scour 0.26-34,421,52029.6%205
SVG Cleaner 0.5.13,727,88340.6%thirty
SVG Optimizer 0.372,646,54157.9%15
SVG Scour + SVG Cleaner + SVG Optimizer2,502,13660.1%240
I conducted testing with a large number of images, the above table almost accurately displays my test results.

Conclusion


  1. Consistent use of applications helps to increase the image compression steppe.
  2. SVG is an XML text file, optimization programs can “spoil” images, i.e. browsers do not draw the image correctly.
  3. SVG supports not only vector graphics, but raster, but modern applications for optimizing SVG do not support the optimization of raster images.

Source: https://habr.com/ru/post/170509/


All Articles