Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

9-slicer

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

9-slicer - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

7

package.json
{
"name": "9-slicer",
"version": "0.1.0",
"version": "0.1.1",
"description": "Convert PNG to 9slice",

@@ -20,3 +20,3 @@ "main": "dist/cjs/9slicer.js",

"test": "mocha ./test/index.js",
"build": "run-s lint build:tsc build:rollup:module build:rollup:browser build:uglify:browser build:uglify:esm test",
"build": "run-s lint:build build:tsc build:rollup:module build:rollup:browser build:uglify:browser build:uglify:esm test",
"dev": "run-s build:tsc build:rollup:module test",

@@ -29,3 +29,4 @@ "build:tsc": "tsc",

"demo": "browser-sync start --server demo",
"lint": "tslint --fix './src/**/*.ts'"
"lint:build": "tslint --fix './src/**/*.ts'",
"lint": "tslint './src/**/*.ts'"
},

@@ -32,0 +33,0 @@ "repository": {

# 9-slicer
[![Build Status](https://travis-ci.org/zprodev/9-slicer.svg?branch=master)](https://travis-ci.org/zprodev/9-slicer)
[![npm](https://img.shields.io/npm/v/9-slicer.svg)](https://www.npmjs.com/package/9-slicer)
[![license](https://img.shields.io/github/license/zprodev/9-slicer.svg)](LICENSE)
Automatically judge the enlarged area and create 9 slice images
## Examples
### input
![input.png](https://raw.githubusercontent.com/zprodev/9-slicer/master/docs/img/input.png)
### output
Sliced PNG
![output.png](https://raw.githubusercontent.com/zprodev/9-slicer/master/docs/img/output.png)
Parameters
```
{ width: 420,
height: 240,
left: 46,
right: 45,
top: 48,
bottom: 48 }
```
## Demo

@@ -14,3 +41,3 @@

```
npm i 9-slicer
npm i -D 9-slicer
```

@@ -20,6 +47,24 @@

[for browser](https://github.com/zprodev/9-slicer/tree/master/dist/browser)
[for CommonJS](https://github.com/zprodev/9-slicer/tree/master/dist/cjs)
[for Browser](https://github.com/zprodev/9-slicer/tree/master/dist/browser)
[for ESModules](https://github.com/zprodev/9-slicer/tree/master/dist/esm)
## 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));
}
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc