https://github.com/megahertz/node-purified-image
Load, save and draw on image with API similar to HTML Canvas Context 2D. No native dependencies.
https://github.com/megahertz/node-purified-image
Last synced: 11 months ago
JSON representation
Load, save and draw on image with API similar to HTML Canvas Context 2D. No native dependencies.
- Host: GitHub
- URL: https://github.com/megahertz/node-purified-image
- Owner: megahertz
- License: mit
- Created: 2016-05-26T17:38:10.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2021-04-08T14:51:46.000Z (about 5 years ago)
- Last Synced: 2025-07-19T11:02:03.972Z (11 months ago)
- Language: JavaScript
- Homepage:
- Size: 160 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# node-purified-image
[](https://travis-ci.org/megahertz/node-purified-image)
[](https://badge.fury.io/js/purified-image)
## Description
Load, save and draw with API similar to HTML Canvas Context 2D.
No native dependencies. Wrap
[PureImage](https://github.com/joshmarinacci/node-pureimage) library.
## Requirements
- node >= 8
## PureImage
PureImage is a pure JavaScript implementation of image drawing and encoding
API, based on HTML Canvas, for NodeJS. It has no native dependencies.
Current features:
- set pixels
- stroke and fill paths (rectangles, lines, quadratic curves, bezier curves, arcs/circles)
- copy and scale images (nearest neighbor)
- import and export JPG and PNG from streams using promises
- render basic text (no bold or italics yet)
- anti-aliased strokes and fills
- transforms
- standard globalAlpha and rgba() alpha compositing
- clip shapes
## Installation
Install with [npm](https://npmjs.org/package/purified-image):
npm install purified-image
## Usage
```js
const Image = require('purified-image');
let image = new Image('img/template.png');
image
.loadFont('/res/OpenSans.ttf')
.draw(ctx => {
ctx.fillStyle = '#000000';
ctx.font = '20 Open Sans';
ctx.fillText('example', 30, 30);
})
.save('out.jpg')
.then(() => console.log('saved'));
```
## API
[class Image](docs/api-Image.md)
## License
Licensed under MIT.