Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ You can provide a platform-specific icon by creating a subfolder with the name o

### Requirements

#### ImageMagick
#### GraphicsMagick

Install on a Mac:

$ brew install imagemagick
$ brew install graphicsmagick

On linux:

$ sudo apt-get install imagemagick
$ sudo apt-get install graphicsmagick

On windows, see http://www.imagemagick.org/script/binary-releases.php#windows. Also, on the version 7.0.0+ you will have to check the 'Install legacy utilities' option (which is not enabled by default).
On windows, see http://www.graphicsmagick.org/INSTALL-windows.html.


---
Expand Down
59 changes: 28 additions & 31 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var fs = require('fs');
var path = require('path');
var ig = require('imagemagick');
var gm = require('gm');
var colors = require('colors');
var _ = require('underscore');
var Q = require('q');
Expand Down Expand Up @@ -273,21 +273,19 @@ var generateIcon = function (platform, icon) {
if (fs.existsSync(platformIconPath)) {
srcPath = platformIconPath;
}
ig.resize({
srcPath: srcPath,
dstPath: filePath,
quality: 1,
format: icon.name.replace(/.*\.(\w+)$/i, '$1').toLowerCase(),
width: icon.size,
height: icon.size,
}, function (err, stdout, stderr) {
if (err) {
deferred.reject(err);
} else {
deferred.resolve();
display.success(icon.name + ' created');
}
});
gm(srcPath)
.quality(100)
.resize(icon.size, icon.size)
.setFormat(icon.name.replace(/.*\.(\w+)$/i, '$1').toLowerCase())
.write(filePath, function(err){
if (err) {
deferred.reject(err);
}
else{
deferred.resolve();
display.success(icon.name + ' created');
}
})
} catch (error) {
deferred.reject(err);
}
Expand Down Expand Up @@ -381,21 +379,20 @@ var generateSplash = function (platform, splash) {
if (fs.existsSync(platformIconPath)) {
srcPath = platformIconPath;
}
ig.crop({
srcPath: srcPath,
dstPath: filePath,
quality: 1,
format: splash.name.replace(/.*\.(\w+)$/i, '$1').toLowerCase(),
width: splash.width,
height: splash.height,
}, function (err, stdout, stderr) {
if (err) {
deferred.reject(err);
} else {
deferred.resolve();
display.success(splash.name + ' created');
}
});

gm(srcPath)
.gravity('Center')
.resize( (splash.width < splash.height)? null : splash.width, (splash.width < splash.height)? splash.height : null)
.extent(splash.width, splash.height)
.quality(100)
.write(filePath, function(err){
if (err) {
deferred.reject(err);
} else {
deferred.resolve();
display.success(splash.name + ' created');
}
})
} catch (error) {
deferred.reject(err);
}
Expand Down
92 changes: 46 additions & 46 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
{
"name": "splashicon-generator",
"version": "0.2.12",
"description": "Automatic icon & splash resizing for PhoneGap",
"main": "index.js",
"preferGlobal": false,
"bin": {
"splashicon-generator": "./bin/splashicon-generator"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git://github.com/eberlitz/splashicon-generator.git"
},
"keywords": [
"cordova",
"phonegap",
"icon",
"splash",
"resize"
],
"author": {
"name": "Eduardo Eidelwein Berlitz",
"email": "eberlitz@gmail.com"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/eberlitz/splashicon-generator/issues"
},
"homepage": "https://github.com/eberlitz/splashicon-generator",
"dependencies": {
"colors": "^0.6.2",
"imagemagick": "^0.1.3",
"node-fs": "^0.1.7",
"q": "^1.0.1",
"underscore": "^1.6.0",
"yargs": "^3.8.0"
},
"contributors": [
{
"name": "Luiz Pereira de Souza Filho",
"email": "lpsouza@gmail.com"
}
]
}
"name": "splashicon-generator",
"version": "0.2.12",
"description": "Automatic icon & splash resizing for PhoneGap",
"main": "index.js",
"preferGlobal": false,
"bin": {
"splashicon-generator": "./bin/splashicon-generator"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git://github.com/eberlitz/splashicon-generator.git"
},
"keywords": [
"cordova",
"phonegap",
"icon",
"splash",
"resize"
],
"author": {
"name": "Eduardo Eidelwein Berlitz",
"email": "eberlitz@gmail.com"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/eberlitz/splashicon-generator/issues"
},
"homepage": "https://github.com/eberlitz/splashicon-generator",
"dependencies": {
"colors": "^0.6.2",
"gm": "^1.23.0",
"node-fs": "^0.1.7",
"q": "^1.0.1",
"underscore": "^1.6.0",
"yargs": "^3.8.0"
},
"contributors": [
{
"name": "Luiz Pereira de Souza Filho",
"email": "lpsouza@gmail.com"
}
]
}