Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
imagewordfinder
Advanced tools
Wrapper library for Google vision OCR to find position of a word/line/para in a image.
Wrapper library for Google vision OCR to find position of a word/line/para in a image.
Installation
npm install imagewordfinder
Include the module
const wordFinder = require('imagewordfinder');
To find a word in a image
let vertices = await wordFinder.findWord('imagepath.png', "birth");
To find multiple words in a image
let vertices = await wordFinder.findWord('imagepath.png', [
"Name",
"Current Address",
"Contact Information",
]);
To find words in a image with case insensitivity (By default, it is case sensitive)
let options = {
caseSensitive: false,
}
let vertices = await wordFinder.findWord('imagepath.png', [
"Name",
"Current Address",
"Contact Information",
], options);
vertices = await wordFinder.findWord('imagepath.png', "birth", options);
The output of the word finder is as follows,
let vertices = await wordFinder.findWord('imagepath.png', "birth");
console.log(vertices);
==================================================================
{
"para_text": "Alternate Names - List any names by which you are known or any names Date of Birth",
"vertices": {
"width": 17,
"height": 9,
"origin": {
"x": 374,
"y": 201
}
},
"index": {
"page_index": 0,
"block_index": 5
},
"para_vertices": {
"origin": {
"x": 39,
"y": 188
},
"height": 23,
"width": 471
},
"word": "birth"
}
The above vertices can be used in various ways:
let vertices = await wordFinder.findWord('imagepath.png', "birth");
let x = vertices.vertices.origin.x;
let y = vertices.vertices.origin.y;
let xEnd = vertices.vertices.origin.x + vertices.vertices.width;
let yEnd = vertices.vertices.origin.y + vertices.vertices.height;
let element = document.createElement('div');
element.style.position = "absolute";
element.style.left = vertices.vertices.origin.x;
element.style.top = vertices.vertices.origin.y;
element.style.width = vertices.vertices.origin.x + vertices.vertices.width;
element.style.height = vertices.vertices.origin.y + vertices.vertices.height;
let body = document.getElementsByTagName('body')
body[0].appendChild(element);
To find distance between two words in a image
let distance = await wordFinder.findWord('imagepath.png', "Name", "Date of Birth");
The object format of distance object is as below,
{
"distanceX": 306,
"distanceY": 25,
"word1": {
"para_text": "Personal Information Name ( First , Middle , Last , Suffix )",
"vertices": {
"width": 24,
"height": 11,
"origin": {
"x": 38,
"y": 176
}
},
"index": {
"page_index": 0,
"block_index": 5
},
"para_vertices": {
"origin": {
"x": 38,
"y": 160
},
"height": 27,
"width": 119
},
"word": "Name"
},
"word2": {
"para_text": "Alternate Names - List any names by which you are known or any names Date of Birth",
"vertices": {
"width": 17,
"height": 9,
"origin": {
"x": 344,
"y": 201
}
},
"index": {
"page_index": 0,
"block_index": 5
},
"para_vertices": {
"origin": {
"x": 39,
"y": 188
},
"height": 23,
"width": 471
},
"word": "Date of Birth"
}
}
To get all paragraphs and words with position in a image
let paragraphs = await wordFinder.getParagraphs('imagepath.png');
FAQs
Wrapper library for Google vision OCR to find position of a word/line/para in a image.
The npm package imagewordfinder receives a total of 9 weekly downloads. As such, imagewordfinder popularity was classified as not popular.
We found that imagewordfinder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.