Skip to content

Commit

Permalink
Merge pull request #21 from stefansl/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
stefansl authored Feb 17, 2018
2 parents 10db95c + a26d068 commit 9e16daf
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ release-builds
/.gitignore
/package-lock.json
build/
dist/
script.sh
/Mac_Distribution_Provisioning_Profiles_.provisionprofile
!/build/
/electron-builder.yml
/dist/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The original graphic will be not replaced.

## Download and Installation on MacOsX
Download Image Shrinker here:
https://github.com/stefansl/image-shrinker/releases/download/v1.3.0/image-shrinker-1.3.0.dmg
https://github.com/stefansl/image-shrinker/releases/download/v1.3.1/image-shrinker-1.3.1.dmg

Unpack and copy or drag the app into your MacOSX application folder.
For uninstalling, just drop the app into the bin.
Expand Down
20 changes: 3 additions & 17 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const fs = require('fs');
const path = require('path');
const settings = require('electron-settings');
const svgo = require('svgo');
const spawn = require('child_process').spawn;
const execFile = require('child_process').execFile;
const mozjpeg = require('mozjpeg');
const pngquant = require('pngquant-bin');
const makeDir = require('make-dir');
Expand Down Expand Up @@ -158,32 +158,18 @@ let processFile = (filePath, fileName) => {
}
case '.jpg':
case '.jpeg': {
let jpg = spawn(mozjpeg, ['-outfile', newFile, filePath]);
jpg.stdout.on('data', (data) => {
log.info('stdout: ' + data.toString());
});
jpg.on('close', () => {
execFile(mozjpeg, ['-outfile', newFile, filePath], (err) => {
touchBarResult.label = 'Your shrinked image: ' + newFile;
sendToRenderer(err, newFile, sizeOrig);
});
jpg.on('exit', (code) => {
log.info('child process exited with code ' + code.toString());
});

break;
}
case '.png': {
let png = spawn(pngquant, ['-fo', newFile, filePath]);
png.stdout.on('data', (data) => {
log.info('stdout: ' + data.toString());
});
png.on('close', () => {
execFile(pngquant, ['-fo', newFile, filePath], (err) => {
touchBarResult.label = 'Your shrinked image: ' + newFile;
sendToRenderer(err, newFile, sizeOrig);
});
png.on('exit', (code) => {
log.info('child process exited with code ' + code.toString());
});
break;
}
default:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "image-shrinker",
"version": "1.3.0",
"version": "1.3.1",
"description": "GUI for minifying images",
"main": "main.js",
"title": "Image Shrinker",
Expand Down

0 comments on commit 9e16daf

Please sign in to comment.