Skip to content

raabbajam/catcha

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.
  • digitOnly: will pass '-digits' parameter for tesseract so it will only recognized digits.

TODO

  • Accept more image processing libraries. OpenCV, etc.
  • Accept option to specify .tmp directory
  • Add skewed image detection and auto-deskewing.
  • Add training method where user input images and expected output then kitten will find the best tranforms settings.
  • Add .gitkeep to .tmp directory / use mkdirp to make sure it exists.

Contributors

License

MIT © Raabb Ajam

About

Quick and easy captcha resolver.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors