Intelligent screen text extraction library with OCR, hotkeys, batch processing, and AI capabilities
npm install mani-screensensebash
npm install mani-screensense
`
---
🚀 Quick Start (One-Liners!)
`javascript
const { screenToText, imageToText, screenshot } = require('mani-screensense');
// 📸 Capture screen → text
const text = await screenToText();
// 🖼️ Image file → text
const text = await imageToText('./document.png');
// 📷 Save screenshot
await screenshot('./screen.png');
`
---
🖥️ CLI Tool
`bash
npm install -g mani-screensense
Commands
screensense capture # Screen → text
screensense read ./doc.png # Image → text
screensense screenshot # Save screenshot
screensense capture --copy # Copy to clipboard
screensense read ./jp.png -l jpn # Japanese OCR
`
---
🔑 Hotkey Support
Register keyboard shortcuts to trigger actions:
`javascript
const { createHotkeyManager } = require('mani-screensense');
const hotkeys = createHotkeyManager({
capture: 'ctrl+shift+s', // Capture screen
region: 'ctrl+shift+r', // Capture region
clipboard: 'ctrl+shift+c' // Read clipboard
});
hotkeys.on('registered', (key) => {
console.log(Hotkey registered: ${key});
});
hotkeys.startListening();
`
---
📁 Batch Processing
Process multiple images at once:
`javascript
const { batchProcess, batchProcessFolder } = require('mani-screensense');
// Process multiple files
const results = await batchProcess([
'./doc1.png',
'./doc2.png',
'./doc3.png'
], {
language: 'eng',
onProgress: (current, total, file) => {
console.log(Processing ${current}/${total}: ${file});
}
});
// Or process entire folder
const results = await batchProcessFolder('./documents', {
format: 'json',
outputPath: './results.json'
});
`
---
👁️ File Watcher
Auto-process new images in a folder:
`javascript
const { watchFolder } = require('mani-screensense');
const watcher = await watchFolder('./inbox', (event) => {
if (event.type === 'added') {
console.log(New file: ${event.file});
console.log(Text: ${event.result.text});
}
});
// Stop watching
await watcher.stop();
`
---
🖼️ Image Preprocessing
Enhance images for better OCR:
`javascript
const { preprocessImage, autoEnhance, presets } = require('mani-screensense');
// Auto-enhance (recommended)
const enhanced = await autoEnhance('./blurry.png');
// Manual options
const processed = await preprocessImage('./image.png', {
grayscale: true,
sharpen: true,
contrast: 30,
denoise: true
});
// Use presets
const docImage = await presets.document('./scan.png');
const photoText = await presets.photo('./photo.png');
const lowQuality = await presets.lowQuality('./bad.png');
`
---
📤 Export Formats
Convert results to different formats:
`javascript
const { analyzeImage, toJSON, toCSV, toHTML, toMarkdown } = require('mani-screensense');
const result = await analyzeImage('./doc.png');
// Different formats
const json = toJSON(result, { includeConfidence: true });
const csv = toCSV(result); // Words with positions
const html = toHTML(result); // Styled HTML page
const md = toMarkdown(result); // Markdown format
`
---
🛠️ Utility Functions
`javascript
const {
extractEmails,
extractUrls,
extractDates,
extractPhoneNumbers,
detectLanguage,
copyToClipboard,
detectCode
} = require('mani-screensense');
const text = "Contact: test@email.com, visit https://example.com";
extractEmails(text); // ['test@email.com']
extractUrls(text); // ['https://example.com']
extractDates(text); // Finds dates in various formats
detectLanguage(text); // 'eng'
detectCode(text); // true if contains code
`
---
🌍 Supported Languages
| Code | Language | Code | Language |
|------|----------|------|----------|
| eng | English | jpn | Japanese |
| spa | Spanish | kor | Korean |
| fra | French | chi_sim | Chinese |
| deu | German | ara | Arabic |
| ita | Italian | hin | Hindi |
| por | Portuguese | rus | Russian |
---
📚 All Features
| Feature | Description |
|---------|-------------|
| One-liners | screenToText(), imageToText(), screenshot() |
| CLI Tool | screensense capture, screensense read` |