GithubHelp home page GithubHelp logo

willsmythe / svg-to-png Goto Github PK

View Code? Open in Web Editor NEW

This project forked from filamentgroup/svg-to-png

0.0 2.0 0.0 242 KB

Turn a folder full of SVGs into PNGs!

License: MIT License

JavaScript 100.00%

svg-to-png's Introduction

svg-to-png Build Status

Filament Group

Converts SVGs to PNGs

Getting Started

Install the module with: npm install svg-to-png

var svg_to_png = require('svg-to-png');

svg_to_png.convert("input", "output") // async, returns promise
.then( function(){
	// Do tons of stuff
});

Documentation

.convert

Required Params

Input

Type: String or Array

The Input can be one of: A String that is the file being converted, a String that is a directory of files to be converted, or an Array of files to convert.

Note: The files passed in MUST ALL be SVGs. If you want to pass in a directory that is not all SVGs, use fs.readdir, filter the results, and pass those in. An error will be thrown otherwise.

Output

Type: String

Output folder

Optional Params

Options

Type: Object

  • defaultWidth: normally 400px
  • defaultHeight: normally 300px
  • compress: Default false, if true, will compress your png file using optipng
  • optimizationLevel: Default 3, if compress is set to true, this will set the optimationLevel for optipng

Examples

Check out the tests!

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

  • v2.0.0 - Breaking change, pngfolder no longer works nor is there at all as an option. Relic of a time where it was necessary.
  • v1.0.0 - Take arrays, add minification capabilities
  • v0.7.0 - Update Phantom for cert error
  • v0.6.0 - Phantom bug fix
  • v0.5.0 - Error Handling
  • v0.4.0 - File separators for Windows
  • v0.3.0 - Tests and Bug Fixes
  • v0.2.0 - API change
  • v0.1.0 - Hey, released this thing

License

Copyright (c) 2013 Jeffrey Lembeck/Filament Group
Licensed under the MIT license.

svg-to-png's People

Contributors

designorant avatar jefflembeck avatar johnbender avatar peekg avatar therealpecus avatar zachleat avatar

Watchers

 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.