A image editor library
const ie = require('image-editor');
ie.readFile('./input.png')
.then(buffer => ie.edit(buffer, 'image/png', 'square', 'Hello'))
.then(buffer => ie.writeFile(buffer, './output.png'))
.then(() => console.log('Done'));
Like gm library, you need install GraphicsMagick
on your computer.
- ImageEditor
- ImageEditor#edit(buffer, mimetype, [type], [text], [color], [fontSize], [filter], [customWidth], [customHeight], [gravity]) =>
Promise
- ImageEditor#readFile(path) =>
Promise
- ImageEditor#writeFile(buffer, path) =>
Promise
- ImageEditor#applyType(buffer, mimetype, [type], [customWidth], [customHeight]) =>
Promise
- ImageEditor#applyFilter(buffer, mimetype, filter) =>
Promise
- ImageEditor#size(buffer) =>
Promise
- ImageEditor#write(buffer, text, [width], [height], [position], [color], [fontSize]) =>
Promise
- ImageEditor#resize(buffer, width, [height], [option]) =>
Promise
- ImageEditor#crop(buffer, width, height, [gravity], [x], [y]) =>
Promise
- ImageEditor#blur(buffer, radius, sigma) =>
Promise
- ImageEditor#mono(buffer) =>
Promise
- ImageEditor#sepia(buffer) =>
Promise
- ImageEditor#mosaic(buffer) =>
Promise
- ImageEditor#negative(buffer) =>
Promise
- ImageEditor#paint(buffer, radius`) =>
Promise
- ImageEditor#pixelate(buffer, mimetype, size) =>
Promise
- ImageEditor#edit(buffer, mimetype, [type], [text], [color], [fontSize], [filter], [customWidth], [customHeight], [gravity]) =>
ImageEditor#edit(buffer, mimetype, [type], [text], [color], [fontSize], [filter], [customWidth], [customHeight])=> Promise
Edit an image
Kind: Exported function
Param | Type | Default |
---|---|---|
buffer | Buffer |
|
mimetype | string |
|
[type] | string |
"default" |
[text] | string |
null |
[color] | string |
"white" |
[fontSize] | number |
30 |
[filter] | string |
null |
[customWidth] | number |
|
[customHeight] | number |
|
Read file and return buffer
Kind: Exported function
Param | Type |
---|---|
path | string |
Write file from buffer to path
Kind: Exported function
Param | Type |
---|---|
buffer | Buffer |
path | string |
Apply type
Kind: Exported function
Param | Type | Default |
---|---|---|
buffer | Buffer |
|
mimetype | string |
|
[type] | string |
"default" |
[customWidth] | number |
|
[customHeight] | number |
|
Apply filters
Kind: Exported function
Param | Type |
---|---|
buffer | Buffer |
mimetype | string |
filter | string |
Get size of picture
Kind: Exported function
Param | Type |
---|---|
buffer | Buffer |
Write something on picture
Kind: Exported function
Param | Type | Default |
---|---|---|
buffer | Buffer |
|
text | string |
|
[width] | number |
0 |
[height] | number |
0 |
[position] | string |
"Center" |
[color] | string |
"white" |
[fontSize] | number |
30 |
Resize picture
Kind: Exported function
Param | Type | Default |
---|---|---|
buffer | Buffer |
|
width | number |
|
[height] | number |
|
[option] | string |
null |
Crop picture
Kind: Exported function
Param | Type | Default |
---|---|---|
buffer | Buffer |
|
width | number |
|
height | number |
|
[gravity] | string |
"Center" |
[x] | number |
0 |
[y] | number |
0 |
Blur image
Kind: Exported function
Param | Type |
---|---|
buffer | Buffer |
radius | number |
sigma | string |
Mono
Kind: Exported function
Param | Type |
---|---|
buffer | Buffer |
Sepia
Kind: Exported function
Param | Type |
---|---|
buffer | Buffer |
Mosaic
Kind: Exported function
Param | Type |
---|---|
buffer | Buffer |
Negative
Kind: Exported function
Param | Type |
---|---|
buffer | Buffer |
Paint
Kind: Exported function
Param | Type |
---|---|
buffer | Buffer |
radius` | number |
Pixelate
Kind: Exported function
Param | Type |
---|---|
buffer | Buffer |
mimetype | string |
size | number |