Socket
Socket
Sign inDemoInstall

omggif

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

omggif

omggif is a JavaScript implementation of a GIF 89a encoder and decoder.


Version published
Maintainers
1
Weekly downloads
1,492,415
increased by2.85%
Install size
38.6 kB

Weekly downloads

Package description

What is omggif?

The omggif npm package is a JavaScript library for reading and writing GIF89a encoded GIF files. It allows for parsing and creating GIFs in a Node.js environment or in the browser. This package is particularly useful for applications that need to manipulate GIF images programmatically, such as generating GIFs on-the-fly, modifying existing GIFs, or extracting information from GIF files.

What are omggif's main functionalities?

Reading GIF Information

This feature allows you to read and extract information from a GIF file, such as its dimensions. The code sample demonstrates how to read a GIF file and log its width and height.

const GifReader = require('omggif').GifReader;
const fs = require('fs');

fs.readFile('path/to/gif.gif', (err, data) => {
  if (err) throw err;
  const reader = new GifReader(data);
  console.log('Width:', reader.width);
  console.log('Height:', reader.height);
});

Writing GIF Images

This feature enables the creation of GIF files programmatically. The code sample shows how to initialize a GIF writer, add a frame to the GIF, and save the GIF to a file.

const GifWriter = require('omggif').GifWriter;
const fs = require('fs');

const buffer = new Uint8Array(256 * 256 * 5); // Example buffer size
const writer = new GifWriter(buffer, 256, 256, { loop: 0 });
// Add frames to the GIF
writer.addFrame(0, 0, 256, 256, frameData, { delay: 50 });

fs.writeFile('path/to/output.gif', buffer, (err) => {
  if (err) throw err;
  console.log('GIF created successfully.');
});

Other packages similar to omggif

Readme

Source

omggif is a JavaScript implementation of a GIF 89a encoder and decoder.

https://github.com/deanm/omggif

(c) Dean McNamee dean@gmail.com, 2013.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Keywords

FAQs

Last updated on 16 Jul 2019

Did you know?

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc