0.0.1 • Published 11 years ago
image-divider v0.0.1
image-divider
Divide a large image to small images
Preparation
Install imagemagick
This npm-module depends on imagemagick CLI tools.
e.g. Mac with Homebrew:
brew install imagemagicke.g. Debian:
sudo apt-get install imagemagickAssert ImageMagick is installed:
$convert --version
Version: ImageMagick 6.8.7-7 Q16 x86_64 2013-11-27 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules
Delegates: bzlib freetype jng jpeg ltdl png xml zlibInstallation
npm install -g image-dividerUsage
1) Put a configuration file like this
image-divider.js:
module.exports = {
images: [{
src: 'path/to/large.png',
pos: [16, 32],
size: [16, 16],
dest: 'path/to/dest/icon-1.png'
}, {
src: 'path/to/large.png',
pos: [16, 48],
size: [16, 16],
dest: 'foo/bar/dest/icon-2.png'
}]
};2) Execute a command
image-divider --conf path/to/image-divider.js3) Then, two small images are created
$tree foo/bar/dest
foo/bar/dest
├── icon-1.png
└── icon-2.pngNote:
--conf, -coption- Set a path to configuration file
- Use
./image-divider.jsif it is not set
0.0.1
11 years ago