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

react-native-gifsicle

v0.0.10

Published

Compress, Optimize and Manipulate GIF in React Native

Downloads

141

Readme

GitHub Repo stars GitHub Repo stars GitHub Repo stars GitHub Repo stars npm

Table of Contents

Installation

yarn add react-native-gifsicle
New Architecture (Turbo Module) Supported

You can give feedback on Discord channel

Managed Expo

expo install react-native-gifsicle

Add the Gifsicle plugin to your Expo config (app.json, app.config.json or app.config.js):

{
  "name": "my app",
  "plugins": ["react-native-gifsicle"]
}

Finally, compile the mods:

expo prebuild

Basic Usage

Javascript

import RNGifsicle from 'react-native-gifsicle';

const manipulatedUri = await RNGifsicle.compressGif(uri, {
  lossy: 100,
  colors: 250,
  // scale_x: 2,
  // scale_y: 2,
  // optimize:3
  // height: 250,
  // width: 300,
});

Setup

Install the package:

yarn add react-native-gifsicle

Link the library:

(Note: For React Native 0.60 or greater, autolinking is available)

or later. For earlier versions you need to manually link the module.)

react-native link react-native-gifsicle

IOS

if cocoapods are used in the project then pod has to be installed as well:

(cd ios; pod install)
  • Manual Link (iOS)

    1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
    2. Go to node_modulesreact-native-gifsicle and add Gifsicle.xcodeproj
    3. Expand the Gifsicle.xcodeprojProducts folder
    4. In the project navigator, select your project. Add Gifsicle.a to your project's Build PhasesLink Binary With Libraries
    5. And go the Build Settings tab. Make sure All is toggled on (instead of Basic)
    6. Look for Header Search Paths and add $(SRCROOT)/../node_modules/react-native-gifsicle/ios/** as non-recursive

API

compressGif(uri, options)

Compresses a GIF located at the specified URI using the provided options.

Parameters

  • uri (string): The URI of the GIF to compress.
  • options (object): The options for compression. Available options are:
    • lossy (number): Alter image colors to shrink output file size at the cost of artifacts and noise. default=200 range [0-200]
    • optimize (number): Optimize output GIFs. default=3 range [1-3]
    • colors (number): Reduce the number of colors to N. default=255 rage [0-255]
    • scale_x (number): Scale the image in the x-axis.
    • scale_y (number): Scale the image in the y-axis.
    • height (number): Resize the output GIF height.
    • width (number): Resize the output GIF width.

Returns

  • A Promise that resolves to a URI of the compressed GIF.

Consider supporting with a ⭐️ star on GitHub

If you are using the library in one of your projects, consider supporting it with a star. It takes a lot of time and effort to keep this maintained and address issues and bugs. Thank you.

Credits goes to

Gifsicle by kohler

Author of this package by Numan