npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cataas-image-editor

v0.4.0

Published

Cataas image editor library

Downloads

3

Readme

Image editor

A image editor library

Example

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'));

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])=> 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 | |

ImageEditor#readFile(path) => Promise

Read file and return buffer

Kind: Exported function

| Param | Type | | --- | --- | | path | string |

ImageEditor#writeFile(buffer, path) => Promise

Write file from buffer to path

Kind: Exported function

| Param | Type | | --- | --- | | buffer | Buffer | | path | string |

ImageEditor#applyType(buffer, mimetype, [type], [customWidth], [customHeight]) => Promise

Apply type

Kind: Exported function

| Param | Type | Default | | --- | --- | --- | | buffer | Buffer | | | mimetype | string | | | [type] | string | "default" | | [customWidth] | number | | | [customHeight] | number | |

ImageEditor#applyFilter(buffer, mimetype, filter) => Promise

Apply filters

Kind: Exported function

| Param | Type | | --- | --- | | buffer | Buffer | | mimetype | string | | filter | string |

ImageEditor#size(buffer) => Promise

Get size of picture

Kind: Exported function

| Param | Type | | --- | --- | | buffer | Buffer |

ImageEditor#write(buffer, text, [width], [height], [position], [color], [fontSize]) => Promise

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 |

ImageEditor#resize(buffer, width, [height], [option]) => Promise

Resize picture

Kind: Exported function

| Param | Type | Default | | --- | --- | --- | | buffer | Buffer | | | width | number | | | [height] | number | | | [option] | string | null |

ImageEditor#crop(buffer, width, height, [gravity], [x], [y]) => Promise

Crop picture

Kind: Exported function

| Param | Type | Default | | --- | --- | --- | | buffer | Buffer | | | width | number | | | height | number | | | [gravity] | string | "Center" | | [x] | number | 0 | | [y] | number | 0 |

ImageEditor#blur(buffer, radius, sigma) => Promise

Blur image

Kind: Exported function

| Param | Type | | --- | --- | | buffer | Buffer | | radius | number | | sigma | string |

ImageEditor#mono(buffer) => Promise

Mono

Kind: Exported function

| Param | Type | | --- | --- | | buffer | Buffer |

ImageEditor#sepia(buffer) => Promise

Sepia

Kind: Exported function

| Param | Type | | --- | --- | | buffer | Buffer |

ImageEditor#mosaic(buffer) => Promise

Mosaic

Kind: Exported function

| Param | Type | | --- | --- | | buffer | Buffer |

ImageEditor#negative(buffer) => Promise

Negative

Kind: Exported function

| Param | Type | | --- | --- | | buffer | Buffer |

ImageEditor#paint(buffer, radius`) => Promise

Paint

Kind: Exported function

| Param | Type | | --- | --- | | buffer | Buffer | | radius` | number |

ImageEditor#pixelate(buffer, mimetype, size) => Promise

Pixelate

Kind: Exported function

| Param | Type | | --- | --- | | buffer | Buffer | | mimetype | string | | size | number |