npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wsvg

v0.0.14

Published

A CLI tool in order to turn SVG input files into hand-drawn looking counterparts

Downloads

16

Readme

Build Status npm version License MIT

wsvg

Description

wsvg is a command line tool which converts SVG-images into hand-drawn looking graphics. It parses the nodes of the SVG-image and turns mostly all straight lines (so polyline, rect and polygon to be precisely) into waggly lines. All styles and other attributes on the nodes will be presevered.

So for example it will turn the left input into the right output:

Example

Usage

CLI tool

Actually there are several ways to make use of the tool.

To install wsvg from npm, run:

$ npm install -g wsvg

After that you should be able to call the tool:

$ wsvg --help

  Usage: wsvg [options]

  Options:

    -h, --help                output usage information
    -V, --version             output the version number
    -p, --png                 Export to PNG
    -c, --content <content>   SVG-content as string input
    -i, --input <path>        Input SVG-File which should be turned into a waggly output-version
    -o, --output <path>       Output filename
    -w, --waggly              Turns on the waggly-mode (without, it won't change anything)
    --fontFamily <font>       Set the output font-family (i.e. Purisa - ttf-tlwg)
    --fontSize <size>         Set the size of the font to be used
    --wagInterval <interval>  Interval for our wags (default is 10)
    --wagSize <interval>      Size for the wags (default is 1.5)

using wagInterval and wagSize you'll be able to adjust the effect.

node module

You can also embed the tool in your own project. All you'll have to do is to install it as a dependency like i.e.:

$ npm install --save wsvg

Afterwards you should be able to require the tool using:

var wagglySvg = require('./waggly-svg');

var config = {
    waggly: true,
    wag_interval: 10,
    wag_size: 1.5,
    font_family: 'Menlo',
    font_size: 12
};

var svgTransformer = wagglySvg.create(config, function(transformed) {
    console.log(transformed);
});

svgTransformer.transformFile('<ns0:polyline fill="none" points="0.5,-60.5 79.70,-60.5 83.5,-60.5" stroke="black"/>');

The module exposes one factory-method which returns the actual transformer based on the given configuration.

Factory

create(config, callback): Creates a new transformer-instance based on the given configuraiton. Currently there are three properties supported:

{
    waggly: true,			// activates the waggly-mode
    wag_interval: 30,	// configures the distance of the wags
    wag_size: 1.5,       // ... and the size of 'em
    font_family: 'Menlo',   // font-family
    font_size: 12           // font-size
}

The callback-function gets the transformed svg-output as parameter for further processing.

Transformer

svgTransformer.transformFile(pathToFile): Starts the transformation by reading the file-input and turning it into a hand-drawn version.

svgTransformer.transformString(stringInput): Starts the transformation based on the given input.

Prerequisites

  • rsvg-convert (i.e. brew install librsvg, suo apt-get install librsvg2-dev or sudo yum install librsvg2-devel) is used to convert svg-graphics to png

License

Copyright (c) 2015 Stefan Schöffmann

MIT License

Acknowledgments

Granted, the idea is not new - but since I'm absolutely no python guy I couldn't contribute to the excellent work of Aivarsk's Scruffy - but got heavily inspired by it. Based on his efforts this module was created.