catcha

1.0.4 • Public • Published

catcha

NPM Version Coverage Status Build Status Downloads Dependency Status License

Quick and easy captcha resolver.

Install

npm i --save catcha

catcha use tesseract-ocr and ImageMagick. Please make sure to have them installed.

Usage

import catcha from "catcha";
 
const settings = {
  transforms: [
    {key: 'resize', value: '240x100'},
    {key: 'colorspace', value: 'gray'},
    {key: 'negate'},
    {key: 'threshold', value: '12%'},
    {key: 'blur', value: '10 '},
    {key: 'threshold', value: '43%'},
    {key: 'negate'},
  ],
  digitOnly: true,
  deleteTemporaryImage: false,
};
const kitten = catcha(settings);
kitten('/tmp/path/to/image/.{tiff,png,jpg}')
  .then((text) => {
    console.log(text); // 314400
  });

Settings

  • transforms: array of key and value for transforms. Will be passed verbatim to ImageMagick parameter.
  • deleteTemporaryImage: default to true. Delete converted image via transforms settings.
  • deleteSourceImage: default to false. Delete source image.
  • resolveBeforeCleaning: default to true. Resolve immediately after OCR ran, without waiting cleaning finished.

TODO

  • Accept more image processing libraries. OpenCV, etc.
  • Added skewed image detection and auto-deskewing.
  • Added training method where user input images and expected output then kitten will find the best tranforms settings.

Contributors

License

MIT © Raabb Ajam

Package Sidebar

Install

npm i catcha

Weekly Downloads

1

Version

1.0.4

License

MIT

Last publish

Collaborators

  • raabbajam