10 个版本 (6 个重大更新)
0.6.0 | 2023年10月9日 |
---|---|
0.5.1 | 2022年3月31日 |
0.5.0 | 2022年2月13日 |
0.4.1 | 2021年10月15日 |
0.3.0 | 2021年7月29日 |
#283 in 图像
6,351 个月下载量
用于 7 个 crate (6 个直接使用)
150KB
3K SLoC
JPEG 编码器
Rust 编写的 JPEG 编码器,具有以下特性:
- 基线和渐进压缩
- 色度子采样
- 优化 Huffman 表
- 1、3 和 4 个组件的色彩空间
- 重启间隔
- 自定义量化表
- 基于 AVX2 的优化(可选)
- 支持 no_std + alloc
- 默认情况下无 unsafe(启用
simd
功能会增加 unsafe 代码)
示例
use jpeg_encoder::{Encoder, ColorType};
// An array with 4 pixels in RGB format.
let data = [
255, 0, 0,
0, 255, 0,
0, 0, 255,
255, 255, 255,
];
// Create new encoder that writes to a file with maximum quality (100)
let mut encoder = Encoder::new_file("some.jpeg", 100)?;
// Encode the data with dimension 2x2
encoder.encode(&data, 2, 2, ColorType::Rgb)?;
crate 特性
std
(默认):启用依赖于 std 库的功能simd
:启用 SIMD 优化(隐含std
且目前仅支持 AVX2)
支持的 Rust 最小版本 (MSRV)
此 crate 至少需要 1.61 或更高版本。
许可证
本项目根据以下任一许可证发布:
- Apache License 2.0,(LICENSE-APACHE 或 https://apache.ac.cn/licenses/LICENSE-2.0)
- MIT 许可证 (LICENSE-MIT 或 https://opensource.org/licenses/MIT)
贡献
除非你明确声明,否则你提交给 jpeg-encoder 的任何有意贡献,根据 Apache-2.0 许可证定义,应按上述方式双重许可,不附加任何额外条款或条件。