https://github.com/whizzes/mince
Mince is a browser utility to reduce image sizes before sending them through HTTP requests using WASM and Rust
https://github.com/whizzes/mince
compression image management resizing rust wasm
Last synced: about 2 months ago
JSON representation
Mince is a browser utility to reduce image sizes before sending them through HTTP requests using WASM and Rust
- Host: GitHub
- URL: https://github.com/whizzes/mince
- Owner: whizzes
- License: mit
- Created: 2023-02-02T05:02:14.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-28T23:46:45.000Z (about 3 years ago)
- Last Synced: 2025-04-08T23:26:42.408Z (about 1 year ago)
- Topics: compression, image, management, resizing, rust, wasm
- Language: Rust
- Homepage: https://www.npmjs.com/package/@whizzes/mince
- Size: 2.55 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE_MIT
Awesome Lists containing this project
README
# mince
Mince comes from "mincing" which means taking something that is roughly chopped and then chopping it finely
> **Warning** This package is under heavy development
## Usage
1. Install package
```bash
npm install @whizzes/mince
```
2. Initialize WASM Module
```ts
import init from "@whizzes/mince";
```
3. Then use the `Mince` class
```ts
import { Mince } from "@whizzes/mince";
const resizeImage = (file: File): Promise => {
const mince: Mince = await Mince.fromFile(file);
const resized: Mince = mince.resize(100, 100);
const file: File = resized.toFile();
// The resulting file is an instance of the Browser's native `File` object
const url = URL.createObjectURL(file);
document.getElementById('image').src = url;
return file;
}
```
## Development
1. Install `wasm-pack`
```bash
cargo install wasm-pack
```
## Geckodriver
https://github.com/rustwasm/wasm-pack/blob/master/src/test/webdriver/geckodriver.rs