9-slicer
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

9-slicer

Build Status npm license

Automatically judge the enlarged area and create 9 slice images

Examples

input

input.png

output

Sliced PNG

output.png

Parameters

{ width: 420,
  height: 240,
  left: 46,
  right: 45,
  top: 48,
  bottom: 48 }

Demo

9 SLICER

Distribution

npm

npm i -D 9-slicer

files

for CommonJS

for Browser

for ESModules

Usage

for CommonJS

const { readFileSync, writeFileSync }  = require('fs');
const { slice } = require('9-slicer');

const input = readFileSync('input.png');
const output = slice(input);

// Example of outputting only things that can be reduced by 30% or more
if(30 <= output.reduction){
  writeFileSync('output.png', output.buffer);
  writeFileSync('output.json', JSON.stringify(output.params));
}

Package Sidebar

Install

npm i 9-slicer

Weekly Downloads

2

Version

0.1.1

License

MIT

Unpacked Size

253 kB

Total Files

13

Last publish

Collaborators

  • zprodev