Crates.io | image-base64-wasm |
lib.rs | image-base64-wasm |
version | 0.6.0 |
source | src |
created_at | 2020-12-15 11:23:30.469026 |
updated_at | 2021-01-15 15:22:12.220807 |
description | Imaging library written in Rust supported by wasm. Provides basic filters and decoders for the most common image formats. |
homepage | |
repository | https://github.com/WasmPot/image-base64-rs.git |
max_upload_size | |
id | 323074 |
size | 455,624 |
Convert jpeg, png, gif, ico to base64, and vise versa
The library is compatible with wasm
To build into wasm, uncomment the target line in .cargo/config
[build]
# target = "wasm32-unknown-unknown"
extern crate image_base64_wasm;
fn main() {
let base64 = "base64 String";
let image = image_base64_wasm::from_base64(base64);
let image_path = "local image file path"
let base64 = image_base64_wasm::to_base64(image_path);
}
Vec<u8>
(useful for url response body)extern crate image_base64_wasm;
fn main() {
let base64 = "base64 String";
let image = image_base64_wasm::from_base64(base64);
let img_data: Vec<u8> = ...; // TODO replace this part
let base64 = image_base64_wasm::vec_to_base64(img_data);
}
Add the dependency to your Cargo.toml
under [dependencies]
:
image-base64-wasm = "0.5.0"
MIT