JSPM

@frsource/is-animated

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 79
  • Score
    100M100P100Q82133F
  • License MIT

Detects animated images in browser & node. Supports GIT, APNG & WebP

Package Exports

  • @frsource/is-animated

Readme

NPM version badge GZIP size calculated by bundlejs.com semantic-release badge license MIT badge

is-animated - Checks if image is animated 🎞

Getting Started · Demo · File an Issue · Have a question or an idea?


A simple library for detecting animated images.
Works under Node and Browser environments!
Performant & with small bundle size
Supports GIF, APNG and WebP
Written completely in typescript
Published under MIT license


Quick start

Installation

npm install @frsource/is-animated

yarn add @frsource/is-animated

pnpm add @frsource/is-animated

Usage in browser

<input type="file" accept="image/*" />
const input = document.querySelector('input[type="file"]');

input.addEventListener('change', async function () {
  const arrayBuffer = await this.files[0].arrayBuffer();
  const answer = isAnimated(arrayBuffer) ? 'Yes' : 'No';
  alert(`Is "${this.files[0].name}" animated? ${answer}.`);
});

Usage in Node.js

import { readFileSync } from 'fs';
import isAnimated from '@frsource/is-animated';

readFileSync('my-test-file.png', (err, buffer) => {
  const answer = isAnimated(buffer) ? 'Yes' : 'No';
  console.log(`Is "my-test-file.png" animated? ${answer}.`);
});

For a working example, check out our demo.

Questions

Don’t hesitate to ask a question directly on the discussion board!

Changelog

Changes for every release are documented in the release notes and CHANGELOG file.

License

MIT @ 2024-present, Jakub FRS Freisler, FRSOURCE

Forked from qzb's great library: is-animated.