2.0.3 • Published 4 years ago

deskew v2.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

Deskew

Deskew performs automatic text skew detection and correction. It is built on top of Jimp.

Deskew works on the basis of line detection using the Hough transform in the rho-theta space.
The hough transform code is based on the Python implementation described by Alyssa Quek.

Installation

Using npm: npm install deskew --save

Usage

const deskew = require("deskew");

deskew("./example.png", {
  precision: 0.1,
  fillColour: 0x0000FFFF // Blue with no alpha transparency.
}).then(deskewedImage => {
  deskewedImage.writeAsync("./deskew.png");
});

Options

precision - Determines the level of precision. Lower will give more accurate results but is more computationally expensive.

fillColour - After rotating an image, there will be locations that have no pixel data associated with them and so are instead made transparent. This option fills such locations with a particular colour.

Current Limitations

Incorrect rotations might be generated if the image contains many parallel lines that aren't apart of the text.

2.0.3

4 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.0

5 years ago