GithubHelp home page GithubHelp logo

renzhezhilu / gifsicle-wasm-browser Goto Github PK

View Code? Open in Web Editor NEW
128.0 3.0 12.0 76.49 MB

Run Gifsicle in the browser ,to GIFs compress, crop, manipulate frames, resize, Etc .

Home Page: https://renzhezhilu.github.io/gifsicle-wasm-browser/

License: MIT License

JavaScript 100.00%
gifsicle gifsicle-in-browser gifsicle-wasm compress-gif

gifsicle-wasm-browser's Introduction

En | 简体中文

Gifsicle Wasm Browser

Run Gifsicle in your browser to compress, crop, frame, resize, and more on GIFs.

Function

  • Fully restore the functionality of Gifsicle 1.92
  • Supports input and output of multiple GIFs
  • Supports multiple commands
  • Small (Gzip≈150KB)
  • no dependencies

Demo

Basic usage

For more commands, please refer to the Gifsicle Manual.

Compression Action Frame Crop Size Other
Low
middle
high






Select the last 2 frames
Select 3 frames before and after
delete the first 20 frames
Replace 3-6 frames with other GIFs
rewind
Alternate 2 GIFs
export all frames



According to the upper left and lower right corners
According to the upper left corner and height and width
Crop after rotation
Crop after flip
Cut out excess transparency




Modify the width to 100px
Shrink by 50%
Modify aspect ratio








loop
read info
merge
Play speed




Complete example

gifsicleTool.js By combining multiple commands, it can complete more practical functions.

Quick start

npm install

import in vue

$ npm i gifsicle-wasm-browser --save
import gifsicle from "gifsicle-wasm-browser";

gifsicle.run({
  input: [{
      file: "./cat.gif",
      name: "1.gif",
  }],
  command: [`
    -e -U 
    --resize 100x_ 
    1.gif 
    -o /out/out.gif`],
})
.then(outGifFiles => {
  console.log(outGifFiles);
  // [File,File,File ...]
});

cdn

cdn demo

<script type="module">
  import gifsicle from 'https://unpkg.com/gifsicle-wasm-browser/dist/gifsical.min.js'
  // or
  import gifsicle from 'https://cdn.jsdelivr.net/npm/gifsicle-wasm-browser/dist/gifsicle.min.js'
      ...
  })
</script>

Api

gifsicle.run(input=[], command=[])

input

  • Array: input GIFs file
  • file

    • String: the web url of the GIF
    • File , Blob , ArrayBuffer: local files obtained via <input type="file">
  • name

    • String: the filename that will be used in command

command

  • Array: command to execute

folder

  • Array: (optional) folder name to be used in command

isStrict

  • Boolean: (optional) command End immediately on error or warning
  • default: false

return

array of GIFs File

Tips

  • Function usage

    • name in input can be customized, but cannot be repeated.
    • The last line of command must contain -o /out/**.gif,
    • The default available directories are / , /out , /tem, when command is executed, all files in /out will be exported
    • command will be executed one by one in sequence, please use multiple gifsicle.run() if you need to process multiple GIFs at the same time. Execute sequentially | Execute simultaneously
  • Experience about compressing Gif

    • Use -O3 or -O2 with caution, especially for large files over 10Mb, the time-consuming will increase exponentially, and the compression effect is almost the same as -O1.
    • The value range of lossy is between 1-200, the larger the value, the more obvious the noise of the Gif image.
    • In my experience, 30-60 is a more balanced choice.

🦁️ Gif:little lion ears

gifsicle-wasm-browser Compression parameter graphic 02

Author

gifsicle-wasm-browser is @renzhezhilu at wasm-codecs/gifsicle and Developed on the basis of gifsicle.

To do

  • single Gif input and output
  • Multiple Gifs input and output (full version)
  • Npm
  • Multi-core processing (SharedArrayBuffer)

gifsicle-wasm-browser's People

Contributors

renzhezhilu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gifsicle-wasm-browser's Issues

Please remove the console.log entries

Hi, thanks for the library, it's been very helpful. The only issue I have with it is that it prints multiple console.log statements every time I invoke gifsicle.run(). Could you consider removing the console.log entries? Perhaps let the caller specify a logger to use if you still want to provide the logged information

Unminified dist

Would it be possible to supply an unminified dist along with the minified one?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.