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

svg-to-png

v4.0.0

Published

Converts SVGs to PNGs

Downloads

8,710

Readme

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
  • debug: enables console log output

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.

Roadmap

This repository is now using lodash style issue management for enhancements. This means enhancement issues will now be closed instead of leaving them open.

The enhancement backlog can be found here: https://github.com/filamentgroup/svg-to-png/issues?utf8=%E2%9C%93&q=label%3Aneeds-votes+sort%3Areactions-%2B1-desc+

Don’t forget to upvote the top comment of each issue with 👍!

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.