Skip to content

PowerShell script to automate the optimization and refinement of SVG files using Inkscape and SVGO. It processes all SVGs in a directory by ungrouping elements, converting strokes to paths, merging paths, removing unnecessary definitions, and optimizing the file size.

Notifications You must be signed in to change notification settings

Gopi-p/svg-optimizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Story

  1. To use SVG icons efficiently in the Flutter we need to generate icon data using the FlutterIcons
  2. As of now FlutterIcons only support the svg file with one tag.
  3. If your svg file contains more than one tag and other special parameters you may get an error (if image looks not as expected please convert to compound path manually.) while importing the icons to FlutterIcons.
  4. Now we need to follow some guideline to refine the svg file to generate the icon font file. Guide.
  5. But when the no of icons is more it will take more time to refine these files manually. So I created a powershell script that uses the inkscape and svgo command line access in windows to automate the process.
  6. Inspiration:- Stack overflow Answer (But this is for macOs).

Prerequisites

  1. Install the svgo globally via npm.

    npm install -g svgo
  2. Download and install the InkScape from the website: https://inkscape.org/

  3. Now update the following path in Environment

    C:\Program Files\Inkscape\bin (inkscape.exe should be there)
    C:\Program Files\nodejs
    C:\Users\<User>\AppData\Roaming\npm
    
  4. If PowerShell restricts script execution, you might need to change the execution policy. To allow script execution, run:

    Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

About

PowerShell script to automate the optimization and refinement of SVG files using Inkscape and SVGO. It processes all SVGs in a directory by ungrouping elements, converting strokes to paths, merging paths, removing unnecessary definitions, and optimizing the file size.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published