# tinyjs-plugin-extract

> 画布扩展，获取画布的：Image 对象、base64 格式的图片、像素值等等

Latest version **1.4.0** (published 2020-12-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install tinyjs-plugin-extract
pnpm add tinyjs-plugin-extract
yarn add tinyjs-plugin-extract
bun add tinyjs-plugin-extract
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2020-12-15 |
| First published | 2017-05-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 57.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | yiiqii |
| Maintainers | yiqi |
| Keywords | tinyjs, plugin |

## Links

- npm: https://www.npmjs.com/package/tinyjs-plugin-extract
- Repository: https://github.com/ant-tinyjs/tinyjs-plugin-extract
- Homepage: https://github.com/ant-tinyjs/tinyjs-plugin-extract#readme
- Issues: https://github.com/ant-tinyjs/tinyjs-plugin-extract/issues
- npm.io page: https://npm.io/package/tinyjs-plugin-extract

## Recent versions

- 1.4.0 (latest) — 2020-12-15
- 1.3.0 — 2020-12-11
- 1.2.1 — 2020-12-10
- 1.2.0 — 2020-12-10
- 1.1.1 — 2020-05-25
- 1.1.0 — 2018-11-30
- 1.0.7 — 2017-12-12
- 1.0.6 — 2017-06-01
- 1.0.5 — 2017-05-31

## README

# tinyjs-plugin-extract

> 画布扩展，获取画布的：Image 对象、base64 格式的图片、像素值等等

## 查看demo

http://tinyjs.net/plugins/tinyjs-plugin-extract.html#demo

## 引用方法

- 推荐作为依赖使用

  - `npm install tinyjs-plugin-extract --save`

- 也可以直接引用线上cdn地址，注意要使用最新的版本号，例如：

  - https://gw.alipayobjects.com/os/lib/tinyjs-plugin-extract/1.4.0/index.js
  - https://gw.alipayobjects.com/os/lib/tinyjs-plugin-extract/1.4.0/index.debug.js

## 起步
首先当然是要引入，推荐`NPM`方式，当然你也可以使用`CDN`或下载独立版本，先从几个例子入手吧！

##### 1、最简单的例子

引用 Tiny.js 源码
``` html
<script src="https://gw.alipayobjects.com/os/lib/tinyjs/tiny/1.3.1/tiny.js"></script>
```
``` js
require('tinyjs-plugin-extract');
// 或者
// import * as extract from 'tinyjs-plugin-extract';

// 新建 App
const app = new Tiny.Application();
const texture = Tiny.Texture.fromImage('https://gw.alipayobjects.com/as/g/tiny/resources/1.0.0/images/logo.png');
const sprite = new Tiny.Sprite(texture);
texture.on('update', function () {
  const image = app.renderer.plugins.extract.image(sprite);
  console.log(image);
  //=> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsC..SuQmCC">
});
```

## 依赖
- `Tiny.js`: [Link](http://tinyjs.net/api)

## API文档

http://tinyjs.net/plugins/tinyjs-plugin-extract.html#docs

---
_Source: https://npm.io/package/tinyjs-plugin-extract · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
