
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
gcp_cloud_vision_lines
Advanced tools
This utility breaks down a full text annotation response from the Google cloud vision API into a neatly parsed Array with each element representing a single line of text, with coords and height and width dimensions.
A simple JS function for getting back lines of text with coords and dimensions from Google Cloud vision API.
Please note: This package is not affiliated with Google in any way. I saw a need for a service that provided parsing of the data returned from Google's Cloud Vision API so I filled it.
For more on the Google Cloud Vision API, please go here https://cloud.google.com/vision/docs/reference/rest/
const vision = require('@google-cloud/vision');
const { cloudVisionLines } = require('gcp_cloud_vision_lines');
// This is the boiler plate for authing if you haven't
//used the gcloud CLI to authenticate to your service account
const client = new vision.ImageAnnotatorClient({
projectId: <YOUR PROJECT ID HERE>,
keyFilename: path.resolve(`YOUR/GCP_KEY_FILE_PATH}`)
});
const filePath = 'PATH/TO/THE/FILE/I/WANT/TO/ANALYZE';
const [result] = await client.documentTextDetection(filePath);
cloudVisionLines(result.fullTextAnnotation); // This is the function exported from the module :)
You should get a response that looks like the following
[
{ text: 'Wahaca ', // the text it found
coords:
{ tl: {"x":516,"y":107}, // the top left coord of the line
tr: {"x":636,"y":107}, // the top right coord of the line
br: {"x":636,"y":155}, // the bottom right coord of the line
bl: {"x":516,"y":155}, // the bottom left coord of the line
w: 120, // the width dimension of the line
h: 48 // the height dimension of the line
}
},
{ text: '19 - 23 Charlotte Street ',
coords:
{ tl: {"x":330,"y":156},
tr: {"x":813,"y":156},
br: {"x":813,"y":207},
bl: {"x":330,"y":207},
w: 483,
h: 51
}
}
];
FAQs
This utility breaks down a full text annotation response from the Google cloud vision API into a neatly parsed Array with each element representing a single line of text, with coords and height and width dimensions.
We found that gcp_cloud_vision_lines 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.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.