GithubHelp home page GithubHelp logo

e621thumbnailer's Introduction

E621 Thumbnail

Generate image & gif thumbnails for videos from e621. Note this module can take upwards of 15 seconds to generate a single thumbnail, you should not keep things waiting for generated thumbnails. If you absolutely NEED them, you should pregenerate them in bulk.

Usage

(any needed temporary files are stored in your operating system's default temporary directory, and are removed once they are no longer needed)

// const genThumbnail = require("e621-thumbnailer");
import genThumbnail from "e621-thumbnailer";

// assuming top level await
// this is specifically the one I used for testing, and it *IS* NSFW
const imageThumb = await genThumbnail("https://static1.e621.net/data/a5/1d/a51d55b12e7a16a37253783e52c4ec21.webm", "image");
// imageThumb is a buffer of image data, which is the thumbnail
// example: https://thumbs.yiff.media/a51d55b12e7a16a37253783e52c4ec21.png

const gifThumb = await genThumbnail("https://static1.e621.net/data/a5/1d/a51d55b12e7a16a37253783e52c4ec21.webm", {
	// defaults
	// the length of the resulting gif, in seconds - increasing this will increase the runtime and SIGNIFICANTLY increase the filesize
	// 2.5 seconds will generally be 40mb, and 5 seconds will be 100+
	gifLength: 2.5,
	// the level of optimization applied to the resulting gif, this will increase the runtime slightly (requires gifsicle to be installed and in your path)
	// * 0 - disabled
	// * 1 - Store only the changed portion of each image.
	// * 2 - Store only the changed portion of each image, and use transparency. (default)
	// * 3 - Try several optimization methods (usually slower, sometimes better results).
	gifOptimizationLevel: 2
});
// gifThumb is a buffer of image data, which is the thumbnail 
// example: https://thumbs.yiff.media/a51d55b12e7a16a37253783e52c4ec21.gif

e621thumbnailer's People

Contributors

donovandmc avatar

Stargazers

 avatar

Watchers

 avatar

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.