New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

electron-ocr

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electron-ocr - npm Package Compare versions

Comparing version 1.1.1 to 2.0.0

13

lib/main.js

@@ -8,7 +8,8 @@ const electron = require('electron');

var mainWindow = null;
const OCRAD = require('./ocrad.js');
app.on('ready', function () {
console.log('suh dude');
mainWindow = new BrowserWindow()
mainWindow = new BrowserWindow({
defaultFontFamily: "menu"
})
mainWindow.loadURL('file://' + __dirname + '/index.html');

@@ -28,7 +29,2 @@ mainWindow.on('closed',function(){

// const convertText = function () {
// };
// SAVE FILE
const saveFile = function (content) {

@@ -42,5 +38,3 @@ var fileName = dialog.showSaveDialog(mainWindow, {

});
if (!fileName) { return; }
fs.writeFileSync(fileName, content);

@@ -51,2 +45,1 @@ };

exports.saveFile = saveFile;
// exports.convertText = convertText;
const electron = require('electron');
const ipc = electron.ipcRenderer;
const $ = require('jquery');
const $imageView = $('.imageView');
const $translatedTextView = $('.translatedText');
const $openFileButton = $('#open-file');
const $saveFileButton = $('#save-file');
const $readImageButton = $('#read-file');
const remote = electron.remote;
const mainProcess = remote.require('./main');
const output = document.getElementById('output');
const canvas = document.querySelector('.imageView');
const OCRAD = require('ocrad.js');
const canvas = document.createElement('canvas');
const context = canvas.getContext('2d');
const img = new Image();
ipc.on('file-opened', function (event, filePath) {
var img = new Image();
const OCRAD = require('ocrad.js');
img.onload = function (event) {
var imagePic = context.drawImage(event.target, 10, 10, event.target.width, event.target.height);
}
img.src = "file://" + filePath;
getImageDataFromPath(filePath, (data) => console.log(data));
});

@@ -29,11 +23,2 @@

$readImageButton.on('click', function(){
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext('2d');
var image = ctx.getImageData(10,10,750,80);
var parsedText = OCRAD(image);
console.log(parsedText)
output.innerHTML = parsedText;
})
$saveFileButton.on('click', function(){

@@ -43,1 +28,16 @@ var string = $translatedTextView.val();

});
function getImageDataFromPath(filePath, callback) {
img.onload = function () {
if (typeof callback === 'function') {
canvas.width = img.width;
canvas.height = img.height;
context.drawImage(img, 0, 0);
var imageData = context.getImageData(0, 0, img.width, img.height);
var parsedText = OCRAD(imageData);
output.innerHTML = parsedText;
callback(imageData, output);
}
}
img.src = 'file://' + filePath;
};
{
"name": "electron-ocr",
"version": "1.1.1",
"version": "2.0.0",
"description": "Optical Character Recognition module for Electron Applications ",

@@ -8,3 +8,3 @@ "main": "lib/main.js",

"start": "electron .",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "mocha"
},

@@ -11,0 +11,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc