百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
L

lepton_jpeg_rust

> 编程语言
开源

将 DropBox Lepton 压缩转换为 Rust

176 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

将 DropBox Lepton 压缩转换为 Rust

Lepton JPEG Compression in Rust

This is a port of the C++ Lepton JPEG compression tool that was released by DropBox dropbox/lepton. We developed a port of the library to Rust, which has basically the same performance characteristics with the advantage of all the safety features that Rust has to offer, due to the work involved in performing an exhaustive security check on the C++ code and the fact that DropBox has deprecated the codebase.

With precise bit-by-bit recovery of the original JPEG, the Lepton compression library is designed for lossless compression of baseline and progressive JPEGs up to 22%. JPEG storage in a cloud storage system is the main application case. Even metadata headers and invalid content are kept in good condition.

How to Use This Library

Rust

The libary is published on crates.io as lepton_jpeg.

Python

The library is published on PyPI as lepton_jpeg_python.

bash
pip install lepton_jpeg_python
python
import lepton_jpeg_python

with open("../images/slrcity.jpg", "rb") as f:
    jpg_data = f.read()

compressed = lepton_jpeg_python.compress_bytes(jpg_data, config)
decompressed = lepton_jpeg_python.decompress_bytes(compressed, config)

assert jpg_data == decompressed

Building From Source

  • Rust 1.89 or Above
bash
git clone https://github.com/microsoft/lepton_jpeg_rust
cd lepton_jpeg_rust
cargo build
cargo test
cargo build --release

Some operations of this library are vectorized such as the IDCT using the Wide crate, so you can get a significant boost if you enable +AVX2.

Executable

Building the Rust project generates an lepton_jpeg_util.exe wrapper that is built as part of the project. It can be used to compress/decompress and also to verify the test end-to-end on a given JPEG. If the input file has a .jpg extension, it will encode. If the input file has a .lep extension, it will decode back to the original.jpg.

It supports the following options:

lepton_jpeg_util.exe [options] []

Option Description
-threads:n Runs with a maximum of n threads. For encoding, this limits the amount of parallelism that can be gotten out of the decoder.
-dump Dumps the contents of a JPG or LEP file, with the -all option, it will also dump the cooefficient image blocks.
-noprogressive Will cause an error if we encounter a progressive file rather than trying to encode it.
-acceptdqtswithzeros Accept images with DQTs with zeros (may cause divide-by-zero).
-iter:n Runs N iterations of the operation. Useful when we are running inside a profiler.
-max-width:n Limit the maximum image width to n pixels, instead of the default 16386. Fails with an error if limit is exceeded.
-max-height:n Limit the maximum image height to n pixels, instead of the default 16386. Fails with an error il limit is exceeded.

Contributing

There are many ways in which you can participate in this project, for example:

  • Submit bugs and feature requests, and help us verify as they are checked in
  • Review source code changes or submit your own features as pull requests.
  • The library uses only stable features, so if you want to take advantage of SIMD features such as AVX2, use the Wide crate (see the idct.rs as an example) rather than intrinsics.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

License

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the Apache 2.0 license.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rust

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言