Giter Site home page Giter Site logo

anemy / svgurt Goto Github PK

View Code? Open in Web Editor NEW
182.0 7.0 15.0 24.12 MB

Image -> SVG Vectorizing Tool - Live at:

Home Page: https://svgurt.com

License: MIT License

HTML 2.11% CSS 7.47% JavaScript 90.43%
png vectorization svg javascript npm-package converter

svgurt's Introduction

Svgurt ยท GitHub license NPM

Svgurt is a configurable, interactive image to SVG converting tool.

Usage

Installation

Install svgurt using NPM, and add it to your package.json dependencies:

npm install svgurt --save

Svgurt can then be used from the command line or programmatically as a module.

Using Svgurt Programatically

Svgurt can be used with node js.

ES5 module:

const svgurt = require('svgurt');

ES6 module:

import svgurt from 'svgurt';

Next call svgurt with a config object:

const config = {
  input: "someImage.jpg",
  output: "output file name",
  blur: 2
};

svgurt(config);

CLI

Full docs can be found in the CLI Documentation.

To run svgurt from command line, navigate to the folder where you have installed it using npm (or anywhere if you use the -g flag). Then run svgurt by supplying a config file: svgurt config.json. Config documentation.

Default Config

When using Svgurt programatically or through the command line, you need to supply a config. Any fields in your configuration that are omitted will default to the following:

{
  input: 'image.jpg', // This can be an array of input file names as well. jpg and png are both supported.
  output: 'svgurt-output', // This is the name of the file svgurt will save to if 'returnSVGString' is 'false'. It will also accept an array sequentially coupled with 'input'.
  returnSVGString: false, // When true the cli or module will return the svg output as a string instead of saving to a file.
  
  // Image Controls
  blur: 0,
  grayscale: false,
  invert: false,
  'Edge Detection': false,
  postBlur: 0,
  posterize: false,
  posterizeLevels: 5,
  lowThreshold: 20,
  highThreshold: 50,
  applyFractalField: false,
  fieldOpacity: 0.5,
  fieldRatioX: 0.01,
  fieldRatioY: 0.01,
  fieldRandomSeed: 9661,

  // SVG Controls
  amplitude: 5,
  amplitudeRandomness: 0.5,
  amountOfLines: 150,
  continuous: false,
  crossHatch: true,
  direction: 30,
  directionRandomness: 0.01,
  displaceOrigin: false,
  lineLength: 6,
  lengthOnColor: true,
  lengthRandomness: 0.2,
  minColorRecognized: 50,
  maxColorRecognized: 200,
  maxRecursiveDepth: 150,
  minLineLength: 1,
  randomSeed: 1011,
  radius: 1.5,
  radiusOnColor: true,
  radiusRandomness: 0.25,
  recursiveAlgorithm: 'fifth', // One of 'first', 'second', 'third', 'fourth', or 'fifth'.
  renderEveryXPixels: 5,
  renderEveryYPixels: 5,
  scale: 1,
  startAtCenterOfShapes: false,
  strokeColor: 'rgb(28, 32, 38)',
  strokeWidth: 1,
  strokeWidthRandomness: 0.1,
  svgRenderType: 'RECURSIVE', // One of: 'CIRCLE', 'CURVE', 'LINE', 'RECURSIVE', or 'CONCENTRIC'.
  wavelength: 3,
  wavelengthRandomness: 0.5,
  waves: 3,
  wavesRandomness: 0.5,
  applyFractalDisplacement: false,
  displacementAmount: 5,
  fractalRatioX: 0.01,
  fractalRatioY: 0.01,
  fractalRandomSeed: 9996,
  autoColor: false,
  circleArcs: 200,
  intensityWeight: 100000,
  radiusStep: '5'
}

Local Development of Svgurt

Installation

Install node js from https://nodejs.org/en/download/

$ # Clone this repo and navigate to the cloned folder.
$ npm install

Development

$ npm start
$ browser https://localhost:3000

If you'd like to see something added, create an issue or make a PR! ๐Ÿš€

License

Svgurt is MIT licensed.

svgurt's People

Contributors

anemy avatar chickenbug avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

svgurt's Issues

Inversion problem

Hi and thanks again for a fun and useful tool. I am seeing the resultant image invert in many instances, when invert is not selected and can't seem to find settings to correct.
Screen Shot 2019-10-24 at 3 39 44 PM

svgRenderType : Trace

Hi, I'm having trouble getting any result using the trace render type programmatically, I noticed that its not listed in the cli.
is this feature supported outside of the live demo?
my config is as follows

{
"input": ".\test\in\amanocollp3.jpg",
"output": "C:/Users/Willard/svgurt/middle/amanocollp3.jpgoutline2",
"Edge Detection": "true",
"lowThreshold": "128",
"highThreshold": "128",
"Edge Detection": "true",
"lowThreshold": "128",
"highThreshold": "128",
"svgRenderType": "TRACE",
"noiseSize": "45",
"fill": "false",
"stroke": "true",
"directionRandomness": "0.04828301190198645",
"applyFractalDisplacement": "true",
"displacementAmount": "6",
"fractalRandomSeed": "28221",
"strokeWidth": ".085"
}

Resultant SVG has partial duplicates left and right

Thank you, Anemy, for this awesome, versatile tool! I am noticing that parts of my image are duplicated to the left and right of the exported SVG. Minor issue, but does mean the SVGs have to be manually edited before plotting.
Screen Shot 2019-09-29 at 3 55 24 PM

Doc: no license specified

Please specify the license applying - I couldn't find a file or mention in the source (Pref NOT GPL).

Very cool lib!

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.