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 🙏

© 2025 – Pkg Stats / Ryan Hefner

svg-captcha-smooth

v1.3.2

Published

generate svg captcha in node.js or express.js, based on svg-captcha(https://github.com/steambap/svg-captcha) but easier to be recognized by human

Downloads

41

Readme

svg captcha smooth

based on svg-captcha(https://github.com/steambap/svg-captcha) generate svg captcha in node.js just for own projects, as we need to make the captcha be recognized much easier by human.

sample image

captcha image by svg-captcha:

image

new captcha image:

image2

install

npm install --save svg-captcha-smooth

usage

var svgCaptcha = require('svg-captcha-smooth');

var captcha = svgCaptcha.create();
console.log(c);
// {data: '<svg.../svg>', text: 'abcd'}

with express

var svgCaptcha = require('svg-captcha-smooth');

app.get('/captcha', function (req, res) {
	var captcha = svgCaptcha.create();
	req.session.captcha = captcha.text;
	
	res.set('Content-Type', 'image/svg+xml');
	res.status(200).send(captcha.data);
});

API

svgCaptcha.create(options)

If no option is passed, you will get a random string of four characters and corresponding svg.

  • size: 4 // size of random string
  • ignoreChars: '0o1i' // filter out some characters like 0o1i
  • noise: 1 // number of noise lines
  • color: true // characters will have distinct colors instead of grey, true if background option is set
  • background: '#cc9966' // background color of the svg image

This function returns an object that has the following property:

  • data: string // svg path data
  • text: string // captcha text

svgCaptcha.createMathExpr(options)

Similar to create api, you have the same options and return value. The difference is that data is a svg will be an math equation on screen and text will be the result of that equation in string, otherwise the usage is the same as above.

svgCaptcha.loadFont(url)

Load your own font and override the default font.

  • url: string // path to your font This api is a wrapper around loadFont api of opentype.js.
    Your may need experiment around various options to make your own font accessible.
    See the following api.

svgCaptcha.options

Gain access to global setting object. It is used for create and createMathExpr api as the default options.

In addition to size, noise, color, and background, you can also set the following property:

  • width: number // width of captcha
  • height: number // height of captcha
  • fontSize: number // captcha text size
  • charPreset: string // random character preset

svgCaptcha.randomText([size|options])

return a random string.

svgCaptcha(text, options)

return a svg captcha based on text provided.

License

MIT