Skip to main content

Rust port of the Lepton JPEG compression library

Project description

Lepton JPEG Compression

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

The library exposes two methods, compress and decompress, which can be invoked as follows:

    with open("my image", "rb") as f:
        jpg_data = f.read()

    config = {"max_jpeg_width": 4096 }
    compressed = lepton_jpeg_python.compress_bytes(jpg_data, config)
    decompressed = lepton_jpeg_python.decompress_bytes(compressed)

    assert jpg_data == decompressed

The following config options are supported:

  • max_jpeg_width: reject compressing images wider than this
  • max_jpeg_height: reject compressioning images taller than this
  • progressive: false to forbid compressing progressive JPEGs
  • reject_dqts_with_zeros: true if we should reject JPEGs with 0 in their quantitization table
  • max_partitions: maximum number of partitions to split JPEG into in order to allow for parallel compression/decompression
  • max_jpeg_file_size: reject JPEGs larger than this

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 opencode@microsoft.com with any additional questions or comments.

License

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the Apache 2.0 license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

lepton_jpeg_python-0.5.7-cp314-cp314-win_amd64.whl (434.6 kB view details)

Uploaded CPython 3.14Windows x86-64

lepton_jpeg_python-0.5.7-cp314-cp314-manylinux_2_34_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

lepton_jpeg_python-0.5.7-cp314-cp314-macosx_11_0_arm64.whl (482.1 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

lepton_jpeg_python-0.5.7-cp313-cp313-win_amd64.whl (433.9 kB view details)

Uploaded CPython 3.13Windows x86-64

lepton_jpeg_python-0.5.7-cp313-cp313-manylinux_2_34_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

lepton_jpeg_python-0.5.7-cp313-cp313-macosx_11_0_arm64.whl (482.4 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

lepton_jpeg_python-0.5.7-cp312-cp312-win_amd64.whl (434.1 kB view details)

Uploaded CPython 3.12Windows x86-64

lepton_jpeg_python-0.5.7-cp312-cp312-manylinux_2_34_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

lepton_jpeg_python-0.5.7-cp312-cp312-macosx_11_0_arm64.whl (482.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

lepton_jpeg_python-0.5.7-cp311-cp311-win_amd64.whl (435.5 kB view details)

Uploaded CPython 3.11Windows x86-64

lepton_jpeg_python-0.5.7-cp311-cp311-manylinux_2_34_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

lepton_jpeg_python-0.5.7-cp311-cp311-macosx_11_0_arm64.whl (483.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

lepton_jpeg_python-0.5.7-cp310-cp310-win_amd64.whl (435.3 kB view details)

Uploaded CPython 3.10Windows x86-64

lepton_jpeg_python-0.5.7-cp310-cp310-manylinux_2_34_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

lepton_jpeg_python-0.5.7-cp310-cp310-macosx_11_0_arm64.whl (483.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lepton_jpeg_python-0.5.7-cp39-cp39-win_amd64.whl (435.4 kB view details)

Uploaded CPython 3.9Windows x86-64

lepton_jpeg_python-0.5.7-cp39-cp39-manylinux_2_34_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.34+ x86-64

lepton_jpeg_python-0.5.7-cp39-cp39-macosx_11_0_arm64.whl (483.1 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

lepton_jpeg_python-0.5.7-cp38-cp38-win_amd64.whl (435.2 kB view details)

Uploaded CPython 3.8Windows x86-64

lepton_jpeg_python-0.5.7-cp38-cp38-manylinux_2_34_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.34+ x86-64

lepton_jpeg_python-0.5.7-cp38-cp38-macosx_11_0_arm64.whl (483.2 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

File details

Details for the file lepton_jpeg_python-0.5.7-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.7-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 f6fbd065fa1747deab78ac05e394d4bd8031760c2ecedeb38c7a7b16da5f9cf8
MD5 6ed5cc8ad8adfcd07b0193827d9fd43c
BLAKE2b-256 2ed7dd63bedf4a773768e7b2a02bde61e5b5d7d3188e6a4b349e1499af68ec0a

See more details on using hashes here.

File details

Details for the file lepton_jpeg_python-0.5.7-cp314-cp314-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.7-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 b8a370f912431ba085d5122f3a5adf9a6e2192d27d28ca0e5223019702075761
MD5 b321d9ead3317f608dab9d8c619a3ab4
BLAKE2b-256 cd9461d6ae209e383af7d84f4cb767a9b9a37175c873c328d947498ad6c9c4b5

See more details on using hashes here.

File details

Details for the file lepton_jpeg_python-0.5.7-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.7-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 82013824d46f1c7910ade01af5f8c7cb7a3441881e688512f953a471afe9a50b
MD5 fe4d47e295cf937bcd5066ad87e78b53
BLAKE2b-256 9615b7b0482b7ceaf43d9fddbb277462b915a9fef4958367ce1ce991a19901ab

See more details on using hashes here.

File details

Details for the file lepton_jpeg_python-0.5.7-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.7-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 7f2d30fd0482f16ff16b123dc091e2b83fb7b4093897b6830e7bd7ddc33c1b20
MD5 7d74ce2245acdcfa5b8c998ab242d390
BLAKE2b-256 a49366ff2cb86bd3c3e2a60d6e50e818381a0d19a07c2f626a292a2a4abe18c3

See more details on using hashes here.

File details

Details for the file lepton_jpeg_python-0.5.7-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.7-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 7f395b4c6aa41ad5a5490df745d48fd86a465043a4657524751b1f62174681a0
MD5 01d4f421faf581190d471473be75badd
BLAKE2b-256 bd1575ddb7acd22114177a770facbd9237b7882152e24a7c341d6493d59d6c1f

See more details on using hashes here.

File details

Details for the file lepton_jpeg_python-0.5.7-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.7-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c654c8390cdd492c42bcefb8e02ad410cc32ea7f21dca43e385b34d615c7eb72
MD5 967b032a8435d18185d082ce31f65c15
BLAKE2b-256 0adcaf1c4752099c296a5f450ed4ccfd7496a82b16f0f395e110352ce578ac5b

See more details on using hashes here.

File details

Details for the file lepton_jpeg_python-0.5.7-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.7-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1bfb18150dc48d632d889d2ae953580d145e66d954cf53137b1cfb0de74d3b4a
MD5 8aa9574eb01b186e86ff995b3efd0ac5
BLAKE2b-256 964754a44993b5867303fa85d47bc355ef54da2a0b171e0ea25be27fe3b7cc45

See more details on using hashes here.

File details

Details for the file lepton_jpeg_python-0.5.7-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.7-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ebde9fd44673535e4a4351343446011ea1c507b2e46e8a804b9eaa779e6792b6
MD5 db4919c59a943861447a9f42d982a7bb
BLAKE2b-256 56f3b1782459e1bd98eabbf55af9bf521b44445cc8dae9783f3abfdcbe908c63

See more details on using hashes here.

File details

Details for the file lepton_jpeg_python-0.5.7-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.7-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1aaa5083e499acc34ca92c467124e76438946053aa1a829aa2711d0440252473
MD5 f32826136282190283b1f866aa139032
BLAKE2b-256 e31625405d3279d9ffa9dccf22a5f50eae34edb0b3915e635e9fae3e6c28c4f7

See more details on using hashes here.

File details

Details for the file lepton_jpeg_python-0.5.7-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.7-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 ecc5a160a227c8512bc7110edf866c297783254c4659de0ec8861a0223d9c143
MD5 77bf6523d95a5bde6a3ba6ceeca84da2
BLAKE2b-256 79287d4214e1475c69bc62cf1444ae9f7afa82b6462ebf332a2de1ea5a2c637a

See more details on using hashes here.

File details

Details for the file lepton_jpeg_python-0.5.7-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.7-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 bc4df2ed63b383a86162fb7f8e7cd667b43931ecc97a8568f44a8bcfbd8c4836
MD5 efe6cbcdcd6975cf92e82f3621ef11a1
BLAKE2b-256 3a549f8403822fdff6f175d66e66c8af3dc808f622623395fd9d67c25c6f26ad

See more details on using hashes here.

File details

Details for the file lepton_jpeg_python-0.5.7-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.7-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a34a4b777297a03e385ea06a7f517de5c4cc6907cb36c3f98658ccbf2b74c7a7
MD5 e47053c6db74a3405c6075eb250985d8
BLAKE2b-256 7286215f273de205034fc392a132ed394fc2dbc760db6bddec15d74a819a909e

See more details on using hashes here.

File details

Details for the file lepton_jpeg_python-0.5.7-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.7-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f705bc0b89437c9242da5db931819d3505215999574a728bb183287ad64f9ebf
MD5 a5c91657c5326c94bf57880cdb9f5562
BLAKE2b-256 1c6d21ebd0570b83a06cda933f6e57bb653e90ce516f15424b5d5d29a1e5681c

See more details on using hashes here.

File details

Details for the file lepton_jpeg_python-0.5.7-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.7-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 f7fe48bedc3a8d3583c4cee8a893dfef841352b62e2feeb35018d2171bce12a5
MD5 7f1479f34a31ffb1ca245aca7c05e67e
BLAKE2b-256 dde14a8eccc4734705dd9dcc47e21546f62135cc2074113437403b1487175415

See more details on using hashes here.

File details

Details for the file lepton_jpeg_python-0.5.7-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.7-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b8dedc4c7d9cb925ef496ee6757748b18f16560e5bf213c1dbdc8a25f6b24b88
MD5 cb61c90b593763afdf8ee890117cb6e2
BLAKE2b-256 61302aa8ce8f31ad49f819085deffa44dee2644e3f5f7cae5ba327997098af71

See more details on using hashes here.

File details

Details for the file lepton_jpeg_python-0.5.7-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.7-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 e61969a37f4c26847de8dc2c04b6c57fbfedd2f3b05ff345e18ca8dfc60a47a0
MD5 399f94cdbe2e37e818a10d5121908018
BLAKE2b-256 7bceaf7ea28cd65e96fcb2743e50627a1a4a2c78545b93d90a24d9470ccd0b24

See more details on using hashes here.

File details

Details for the file lepton_jpeg_python-0.5.7-cp39-cp39-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.7-cp39-cp39-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 8f40a4c52a7af10081664aaeee57a3453624a4ffab02c1f0fa9b48136f580ae2
MD5 a85eeb3f24e4eb60f52549a1c30c19c4
BLAKE2b-256 e3b1d9edcacb1dabc9aba9d4e725ceb15f09a8dcc191220f4ca2c6141eb5698b

See more details on using hashes here.

File details

Details for the file lepton_jpeg_python-0.5.7-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.7-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2a7e31762f03b9add86279aa0305e070149efaf3d162f517be67e2b087eda562
MD5 c0c9adcfb45b7c2925b9a604386fa5b5
BLAKE2b-256 ceab69956d9ae052df976b0a2f43f6984dd862d4217df8317e63c355a64325e3

See more details on using hashes here.

File details

Details for the file lepton_jpeg_python-0.5.7-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.7-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 3759832623fa9f64323edd9e329fce888be615de8d88909e21c8dd2ee3d0db04
MD5 8ea912283b4a30bdd950e5e12b727c23
BLAKE2b-256 bee9f95576287fccb3e32e93ae0c990907596538f768cc003ae36eec4da3aa72

See more details on using hashes here.

File details

Details for the file lepton_jpeg_python-0.5.7-cp38-cp38-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.7-cp38-cp38-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 dd39b03409cd588943a6a90192a69cc22fe87b5e32429072e031d197e7617cd0
MD5 bbc2f6e5b0737ab4fd62b072115606c3
BLAKE2b-256 f00438f6b4a2e0a7f669625ad5807ba11bb6d7571c4600859c62bf070b64eb0b

See more details on using hashes here.

File details

Details for the file lepton_jpeg_python-0.5.7-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.7-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 448f0a6f5832ed078530221a37c226400472473bb499f4dc14dd7ef9634ecf44
MD5 c3543b654225a4a35ca7526e846f3a48
BLAKE2b-256 c77bed15fb3d0cce3acd13fe23dfd305c904c5c8876e6f05fa3665e62a522bea

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page