Socket
Book a DemoInstallSign in
Socket

pap

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pap

Blurs images and renders them to a canvas element

0.6.3
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

Pap

NPM

Renders blurred versions of images to canvas.

Import the module.

const pap = require('pap')();

Load an image and draw it on a canvas.

const imageElement = document.createElement('image');

imageElement.addEventListener("load", function () {
    pap.initialize(imageElement);
    pap.blur(64);
    document.body.appendChild(pap.canvas);
});

imageElement.src = "images/kittens.jpg";

Initialize once, and update blur live.

const Pap = require('pap');
const mage = document.createElement('img');

mage.onload = function () {
    var pap = Pap();
    pap.initialize(mage);
    document.body.appendChild(pap.canvas);
    var inc = 0;
    var blurWave = function () {
        inc += 0.02;
        pap.blur(Math.sin(inc) * 32 + 32);
        requestAnimationFrame(blurWave);
    };

    blurWave();
};

mage.src = "images/kittens.jpg";

Keywords

imageData

FAQs

Package last updated on 25 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.