🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

webp-animation-generator

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webp-animation-generator

Create WebP animation from sample images.

0.1.0
latest
Source
npm
Version published
Weekly downloads
4
300%
Maintainers
1
Weekly downloads
 
Created
Source

Create WebP animation from sample images. You can use image data or canvas directly.

Important notice: this library is optimised only for web usage at the moment.

import { AnimationGenerator } from '../dist/main.js';

const instance = new AnimationGenerator();

await instance.init('/dist/worker.js');

const file1 = await (await fetch('/file-01.webp').then(resp => resp.blob())).arrayBuffer();
const file2 = await (await fetch('/file-02.webp').then(resp => resp.blob())).arrayBuffer();

instance.addFrame(new Uint8Array(file1), { delay: 1000 });
instance.addFrame(new Uint8Array(file2), { delay: 1000 });

const result = await instance.generate();

const blob = new Blob([result.buffer], { type: 'image/webp' });
const img = document.createElement('img');
img.src = URL.createObjectURL(blob);
document.body.appendChild(img)

instance.release();

Keywords

webp

FAQs

Package last updated on 15 Aug 2021

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