Image editor
A image editor library
Example
const ie = ; ie ;
Dependencies
Like gm library, you need install GraphicsMagick
on your computer.
API Reference
ImageEditor
- 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]) =>
Promise
ImageEditor#edit(buffer, mimetype, [type], [text], [color], [fontSize], [filter], [customWidth], [customHeight])=> 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 |
|
Promise
ImageEditor#readFile(path) => Read file and return buffer
Kind: Exported function
Param | Type |
---|---|
path | string |
Promise
ImageEditor#writeFile(buffer, path) => Write file from buffer to path
Kind: Exported function
Param | Type |
---|---|
buffer | Buffer |
path | string |
Promise
ImageEditor#applyType(buffer, mimetype, [type], [customWidth], [customHeight]) => Apply type
Kind: Exported function
Param | Type | Default |
---|---|---|
buffer | Buffer |
|
mimetype | string |
|
[type] | string |
"default" |
[customWidth] | number |
|
[customHeight] | number |
|
Promise
ImageEditor#applyFilter(buffer, mimetype, filter) => Apply filters
Kind: Exported function
Param | Type |
---|---|
buffer | Buffer |
mimetype | string |
filter | string |
Promise
ImageEditor#size(buffer) => Get size of picture
Kind: Exported function
Param | Type |
---|---|
buffer | Buffer |
Promise
ImageEditor#write(buffer, text, [width], [height], [position], [color], [fontSize]) => 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 |
Promise
ImageEditor#resize(buffer, width, [height], [option]) => Resize picture
Kind: Exported function
Param | Type | Default |
---|---|---|
buffer | Buffer |
|
width | number |
|
[height] | number |
|
[option] | string |
null |
Promise
ImageEditor#crop(buffer, width, height, [gravity], [x], [y]) => Crop picture
Kind: Exported function
Param | Type | Default |
---|---|---|
buffer | Buffer |
|
width | number |
|
height | number |
|
[gravity] | string |
"Center" |
[x] | number |
0 |
[y] | number |
0 |
Promise
ImageEditor#blur(buffer, radius, sigma) => Blur image
Kind: Exported function
Param | Type |
---|---|
buffer | Buffer |
radius | number |
sigma | string |
Promise
ImageEditor#mono(buffer) => Mono
Kind: Exported function
Param | Type |
---|---|
buffer | Buffer |
Promise
ImageEditor#sepia(buffer) => Sepia
Kind: Exported function
Param | Type |
---|---|
buffer | Buffer |
Promise
ImageEditor#mosaic(buffer) => Mosaic
Kind: Exported function
Param | Type |
---|---|
buffer | Buffer |
Promise
ImageEditor#negative(buffer) => Negative
Kind: Exported function
Param | Type |
---|---|
buffer | Buffer |
Promise
ImageEditor#paint(buffer, radius`) => Paint
Kind: Exported function
Param | Type |
---|---|
buffer | Buffer |
radius` | number |
Promise
ImageEditor#pixelate(buffer, mimetype, size) => Pixelate
Kind: Exported function
Param | Type |
---|---|
buffer | Buffer |
mimetype | string |
size | number |