Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/m4k15y6666fk/avif-encoder.js
AVIF Image Encoder for JavaScript
https://github.com/m4k15y6666fk/avif-encoder.js
Last synced: 20 days ago
JSON representation
AVIF Image Encoder for JavaScript
- Host: GitHub
- URL: https://github.com/m4k15y6666fk/avif-encoder.js
- Owner: m4k15y6666fk
- License: mit
- Created: 2024-05-27T18:34:17.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-05-27T19:28:24.000Z (7 months ago)
- Last Synced: 2024-05-28T05:03:34.585Z (7 months ago)
- Language: Rust
- Size: 385 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# avif-encoder.js
**.png, .jpeg, .webp, etc. -> .avif**
## Summary / 概要
AVIF Image Encoder for JavaScript (only support for browsers, no supports for Node.js/Deno/Bun etc.)
ブラウザ JavaScript で AVIF 画像をエンコーディングするためのスクリプト
## Usage / 使い方
### Install
```bash
# install all sources into "avif-encoder.js" directory in your current path
git clone "https://github.com/m4k15y6666fk/avif-encoder.js.git"
```### in your JavaScript
```js
// import the module
import Avif from "./avif-encoder.js/dist/index.js";// initialize the encoder
const avif = new Avif();
await avif.init();// ...
// ...// encode image file (File Object) into Uint8Array
// Uint8Array - https://developer.mozilla.org/en-US/docs/Web/API/Uint8Array
const array = await avif.encode(
file, // File Object - https://developer.mozilla.org/en-US/docs/Web/API/File
{
quality: 60,
speed: 4,
debug: false
}
);// OR
// encode ImageData into Uint8Array
const array = await avif.encode_from_pixels(
pixels, // ImageData Object - https://developer.mozilla.org/en-US/docs/Web/API/ImageData
{
quality: 60,
speed: 4,
debug: false
}
)
```> [!NOTE]
> Depending on the environment, encoding may take about 200 seconds or more.
>
> 環境によっては、エンコードには 200 秒以上の時間がかかる可能性があります.## Donate / ご支援
### OFUSE
[https://ofuse.me/m4k15y6666fk](https://ofuse.me/m4k15y6666fk)
## Special Thanks
### ravif
rav1e-based pure Rust library for encoding images in AVIF format (powers the cavif tool)
[https://lib.rs/crates/ravif](https://lib.rs/crates/ravif)