clamp-palette
TypeScript icon, indicating that this package has built-in type declarations

1.2.1 • Public • Published

Clamp Palette

A drawing of bees becomes Sepia Bees

A photo of a Game Boy becomes Game Boy'd Game Boy

Spaghetti becomes Sharp Spaghetti

Give any photo a limited, user-defined palette with just a few lines of code. Check example.js to see how the above images were generated.

Install

npm install clamp-palette

Usage

const ClampPalette = require("clamp-palette").default;
ClampPalette({
    imagePath: "path to image file",
    imageBuffer: "optionally use a buffer instead",
    colors: ["an array of #RRGGBB colors"],
    mimetype: "the mime type of the output image; image/png by default, image/jpeg and image/bmp are also supported",
    callback: (buffer) => console.log("a callback where you can do whatever you want with the resultant buffer"),
    errorcallback: (error) => console.log("callback for if it fails")
});

Contributing

Sure.

License

Code is licensed under the GNU Affero General Public License. I am not a lawyer, but what I intend for that to mean is, if you use this to generate images locally or as a dev dependency for something, have fun. If you use it as a standard dependency for your project and its code is included in your app/package/whatever, then you must distribute your work under an AGPL-compatible license.

Readme

Keywords

Package Sidebar

Install

npm i clamp-palette

Weekly Downloads

0

Version

1.2.1

License

AGPL-3.0-or-later

Unpacked Size

375 kB

Total Files

14

Last publish

Collaborators

  • hauntedbees