phonegap-visuals-generator
v0.2.201704261
Published
Phonegap Splashscreen and Icon Generator
Downloads
5
Maintainers
Readme
phonegap-visuals-generator
Generate resized icons and splashscreens for Phonegap (android, browser, iOS) without using external image manipulation tools like ImageMagick, GraphicsMagick, etc.
This module is based on jimp
and does not require any native dependencies (ImageMagick, GraphicsMagick, etc.).
There is only one exported method: generate()
, which takes in a single argument (a configuration object) with the following options:
destinationPath
- path to the directory that will hold the generated images (defaults to ./tmp/merges/res/
);
baseIconFilePath
- path of the file (png
, jpg
or bmp
) that serves as the icon source image (recommended size 1024 x 1024, defaults to ./icon.png
) ;
baseSplashFilePath
- path of the file (png
, jpg
or bmp
) that serves as the splashscreen source image (recommended size 2048x2048, defaults to ./splash.png
);
splashBgColor
- color of the background used for splashscreens (hex RGBA format like 0xf0d6baff
- the last pair represents the opacity level) or transparent
to leave the background untouched;
generateXmlFile
- whether to generate the XML file that will contain all the items required by Phonegap, defaults to true
;
xmlFilePath
- path where the XML file that will contain all the items required in Phonegap's config.xml will be generated (defaults to ./tmp/items.xml
;
destinationPathInXml
- path that will be prefixed to the src of all the items in the generated XML;
Installation:
npm install --save phonegap-visuals-generator
Example usage:
put this:
let pgVisualsGenerator = require('phonegap-visuals-generator');
pgVisualsGenerator.generate({
destinationPath: "./temp/",
baseIconFilePath: "./images/icon.png",
baseSplashsFilePath: "./images/splash.png",
splashBgColor: 0xff005500,
generateXmlFile: true,
xmlFilePath: "./temp/items.xml",
destinationPathInXml: "temp/merges/res/",
});
inside a file (e.g.: myfile.js
) and run it with
node myfile.js
and when everything is complete, you should have all the resized images inside the destinationPath
and also an XML file containing all the items.