Giter Club home page Giter Club logo

svg-stroke-to-path's Introduction

svg-stroke-to-path

Illustation explaining what this does

Shell script to convert strokes in an SVG to paths using Inkscape's CLI.

Why?

I needed a tool that converts strokes into paths for a font automation tool. Long story short, FontForge really does not like strokes.

This script is an incredibly hacky way of doing this, but it gets the job done.

Rather than implementing a custom algorithm to do stroke conversion, it uses Inkscape's command-line-interface (CLI) to do the heavy lifting. It's not pretty... So this is not recommended for production.

Requirements

  • Inkscape
    • On macOS, install Brew, then run brew cask install inkscape

Note: The script has only been tested on Inkscape versions:

  • Inkscape 0.92.2 5c3e80d, 2017-08-06
  • Inkscape 1.0beta1 (32d4812, 2019-09-19)

Installing

make install

Usage

$ svg-stroke-to-path -h

Usage: svg-stroke-to-path select_method select_attr file ...

  select_method can be one of:
    * All - Select all objects
    * AllInAllLayers - Select all objects in all visible and
      unlocked layers
    * SameFillStroke - Select all objects with the same fill
      and stroke as the selected objects
    * SameFillColor - Select all objects with the same fill
      as the selected objects
    * SameStrokeColor - Select all objects with the same
      stroke as the selected objects
    * SameStrokeStyle - Select all objects with the same stroke
      style (width, dash, markers) as the selected objects

  select_attr can be a variety of SVG attributes, for example:
    * 'stroke="#000"'
    * 'fill="#000"'
    * 'stroke="red" stroke-weight="2"'

Example:

svg-stroke-to-path SameStrokeColor 'stroke="#000"' test/input.svg

Running this command will launch Inkscape for a split second, so don't be shocked!

svg-stroke-to-path's People

Contributors

leifgehrmann avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.