Skip to content

ahkohd/thumbo-core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

74 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

thumbo-core

😱 Dead fast thumbnail library for browser and NodeJs

Build & Test

Built with Rust πŸ¦€ & WebAssembly πŸ•Έ

πŸ“– About

thumbo-core is a thumbnail library for browsers and NodeJs, built with Rust and WebAssembly in other to achieve closer to native speed!

It supports thumbnail generation for Png, Jpeg, Gif, Ico, Webp and Svg! Webp support is a work in progress.

πŸ“£ If you plan to use thumbo-core, it should be used with a Webworker so you don't block the main thread! If you don't want to go through this hassle, use thumbo, it provides a worker pool to handle thumbnail generation using thumbo-core out of the box.

🚴 Usage

πŸ§ͺ Sample usage

import * as thumbo from "thumbo-core";

const img = await fetch("/path/to/img.png");

const thumbnail = thumbo.thumbnail(
  new Uint8Array(await img.arrayBuffer()),
  thumbo.ImageFormat.Png,
  20,
  20
);

const thumbnail_blob = new Blob([thumbnail], { type: "image/png" });
const url = URL.createObjectURL(thumbnail_blob);

document.getElementById("img").src = url;

βš™οΈ API Reference

thumbo.ImageFormat

An enum of image formats supported by thumbo-core.

thumbo.thumbnail(image_buffer: Uint8Array, format: thumbo.ImageFormat, width, height)

Creates a thumbnail from the provided image buffer.

πŸ‘·πŸ½ Development

πŸ› οΈ Build with wasm-pack build

wasm-pack build

πŸ”¬ Test in Headless Browsers with wasm-pack test

wasm-pack test --headless --chrome

🎁 Publish to NPM with wasm-pack publish

wasm-pack publish

About

😱 dead fast thumbnail library for browser and NodeJs! Built with Rust πŸ¦€ and WebAssembly πŸ•Έ

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE_APACHE
MIT
LICENSE_MIT

Stars

Watchers

Forks

Packages

No packages published

Languages