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

inkpaint

v2.8.1

Published

InkPaint is a lightweight node.js canvas graphics animation library.

Downloads

2,694

Readme

InkPaint — canvas graphics rendering library for node.js

Overview

InkPaint is a lightweight node.js canvas graphics animation library. It forks from the famous canvas engine pixi.js. You can use it to do server-side image synthesis.

InkPaint has a lot of performance optimization and code refactoring. One of its application Demo is FFCreator https://github.com/tnfe/FFCreator video processing library.

At the same time, inkpaint is a common library between node.js and the browser, and it can still run normally on the browser side.

Current features

  • WebGL renderer (headless-gl)
  • Canvas renderer (node-canvas)
  • Super easy to use API
  • Support for texture atlases
  • Asset loader / sprite sheet loader
  • Support multiple text effects
  • Various Sprite effects and animations
  • Masking and Filters

Basic Usage

npm install inkpaint
const fs = require("fs-extra");
const { Application, Sprite, Ticker, Loader } = require("inkpaint");

const width = 800;
const height = 600;

const app = new Application(width, height);
const loader = new Loader();
loader.add("boy", "./assets/boy.png");
loader.load(loaded);

function loaded(loader, resources) {
  const boy = new Sprite(resources.boy.texture);
  boy.x = width / 2;
  boy.y = height / 2;
  boy.anchor.set(0.5);
  app.stage.addChild(boy);
}

const ticker = new Ticker();
ticker.start();
ticker.add(() => {
  app.render();
  boy.x += 0.1;
});

// save image
const buffer = app.view.toBuffer("image/png");
fs.outputFile("./hello.png", buffer);

Save Image

InkPaint supports saving pictures in multiple formats, you can refer to the api of node-canvas https://github.com/Automattic/node-canvas#canvastobuffer. You can save any animated graphics supported by the browser on the server side.

Installation

Install node-canvas and headless-gl dependencies

If it is a computer with a display device, such as a personal pc computer with windows, Mac OSX system, or a server server with a graphics card or display device, you can skip this step without installing this dependency.

If you are using Centos, Redhat, Fedora system, you can use yum to install.

sudo yum install gcc-c++ cairo-devel pango-devel libjpeg-turbo-devel giflib-devel

InstallXvfb and Mesa

sudo yum install mesa-dri-drivers Xvfb libXi-devel libXinerama-devel libX11-devel

If you are using Debian, ubuntu system, you can use apt to install.

sudo apt-get install libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev build-essential g++
sudo apt-get install libgl1-mesa-dev xvfb libxi-dev libx11-dev

Start Up

If it is a computer with a display device, such as a personal pc computer or a server server with a graphics card or display device, start normally npm start

Otherwise, You must use the xvfb-run script command to start the program to use webgl under the Linux server

xvfb-run more detailed command parameters http://manpages.ubuntu.com/manpages/xenial/man1/xvfb-run.1.html

xvfb-run -s "-ac -screen 0 1280x1024x24" npm start

How to build

Note that for most users you don't need to build this project. If all you want is to use InkPaint, then just download one of our prebuilt releases. Really the only time you should need to build InkPaint is if you are developing it.

If you don't already have Node.js and NPM, go install them. Then, in the folder where you have cloned the repository, install the build dependencies using npm:

npm install

Compile the node.js package

npm run lib

At the same time, inkpaint is a common library between node.js and the browser, and it can still run normally on the browser side. If you want to view the example on the browser side, please execute

npm run web

To execute the example under node.js, execute

npm run examples

License

This content is released under the (http://opensource.org/licenses/MIT) MIT License.