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.8-cp314-cp314-win_amd64.whl (433.6 kB view details)

Uploaded CPython 3.14Windows x86-64

lepton_jpeg_python-0.5.8-cp314-cp314-manylinux_2_34_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

lepton_jpeg_python-0.5.8-cp314-cp314-macosx_11_0_arm64.whl (478.7 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

lepton_jpeg_python-0.5.8-cp313-cp313-win_amd64.whl (434.2 kB view details)

Uploaded CPython 3.13Windows x86-64

lepton_jpeg_python-0.5.8-cp313-cp313-manylinux_2_34_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

lepton_jpeg_python-0.5.8-cp313-cp313-macosx_11_0_arm64.whl (478.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

lepton_jpeg_python-0.5.8-cp312-cp312-win_amd64.whl (434.6 kB view details)

Uploaded CPython 3.12Windows x86-64

lepton_jpeg_python-0.5.8-cp312-cp312-manylinux_2_34_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

lepton_jpeg_python-0.5.8-cp312-cp312-macosx_11_0_arm64.whl (479.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

lepton_jpeg_python-0.5.8-cp311-cp311-win_amd64.whl (435.7 kB view details)

Uploaded CPython 3.11Windows x86-64

lepton_jpeg_python-0.5.8-cp311-cp311-manylinux_2_34_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

lepton_jpeg_python-0.5.8-cp311-cp311-macosx_11_0_arm64.whl (479.9 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

lepton_jpeg_python-0.5.8-cp310-cp310-win_amd64.whl (435.6 kB view details)

Uploaded CPython 3.10Windows x86-64

lepton_jpeg_python-0.5.8-cp310-cp310-manylinux_2_34_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

lepton_jpeg_python-0.5.8-cp310-cp310-macosx_11_0_arm64.whl (480.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lepton_jpeg_python-0.5.8-cp39-cp39-win_amd64.whl (435.6 kB view details)

Uploaded CPython 3.9Windows x86-64

lepton_jpeg_python-0.5.8-cp39-cp39-manylinux_2_34_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.34+ x86-64

lepton_jpeg_python-0.5.8-cp39-cp39-macosx_11_0_arm64.whl (480.2 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

lepton_jpeg_python-0.5.8-cp38-cp38-win_amd64.whl (435.5 kB view details)

Uploaded CPython 3.8Windows x86-64

lepton_jpeg_python-0.5.8-cp38-cp38-manylinux_2_34_x86_64.whl (3.1 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.34+ x86-64

lepton_jpeg_python-0.5.8-cp38-cp38-macosx_11_0_arm64.whl (480.1 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.8-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 3b3800dac74fb1b1700de8f26fa627e245d92a8270c5855c569c1b7d9de4ffb6
MD5 b338c1b3662e7ce15fa15ac27fd4f043
BLAKE2b-256 2797aaa98ccf3b7f5224cc8249fb70eaa1c33226a9962d50e6c0bc93bb2030b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.8-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 2e7c9d7121677161282540b9e6b32891be1d983d6b197c10d888e8626536f4c6
MD5 4a0ec64666ef591ba956146e435a3211
BLAKE2b-256 1249393dc09896c73693504ff32176661b5d32fbdc8526309c8aa3cac50e2fda

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.8-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a1f7aba3cc4412a40266af84dc034b3df7cc2bce5cc9668e7bbf4db5ddd6404d
MD5 03f09c26edc88931abaa281b799d11ec
BLAKE2b-256 ea4636c323d5bc89ee9e6ca8f1496637dfb3a1dd026a015713d376b7dbf1abc5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.8-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8e9c57fcbc817706bc359e938868e9c1931685aef32f28e6c2d253615bb8b611
MD5 8b0b40b3bef7279f8bce9fc44334e2fd
BLAKE2b-256 558982eea9dac751a0d683af70794c9ec94e69188564a8a49a485c8f386b1891

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.8-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 40d8b934f1dc0227425a90cc9c5baa76e2c0e037e121d717369da419b82d6851
MD5 9d34a13a2aa429370f1ff309f6a62812
BLAKE2b-256 ddaec7d79110aa138ddbd90188f8886d9c9693ff69f23e213e30e5d25759b82d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.8-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1453191498230336c2fc27d248cc4b30ea910e3715c072c4b67bbf16471f57e8
MD5 03da2888df93728d7286a624b044712e
BLAKE2b-256 b4bb469a43164e0f67291588d532c891da41dd631c889e6f4f0ff341c4ad39c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.8-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 f96fab57eb0947886fa507e2f5eba9175b70b9dc20236e21e5b4703d71c1a998
MD5 24135c6b159de46270482d9e753727fa
BLAKE2b-256 b47572e4c6a1d1ec6558160996990668b5042415194a8bd231d0c9461ce0b184

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.8-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 05016e2d22900f7aa4c01275b86bf41037c9fba1a733b2816f2f19412afae172
MD5 374d6c8382030d50e5adecc6f051dc53
BLAKE2b-256 0518608d4924a66dc5fbf872ee5bea58ad6586ca766caa439278c4e23bafad73

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.8-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 665e15ddc586346416680b9ab9a6009630bba4e0d50f431c024b1f1d76ff8bbc
MD5 708b9a6e486bd108b5b0c303b22fbcd8
BLAKE2b-256 3a5568f29e2b1aba67ae8151fb994062ffe155882c93fc75f4ec6d3c24ee2092

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.8-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a88c1fd83df8316592a5d94d7ec2363e72e9f0dea68d9c6b226a8b5f10b2d133
MD5 5aeddcaa7cf2173e637da35ebda04e44
BLAKE2b-256 fbc25794f57eadfcd641b1a2053072e6b5dc6b4e3afd9c684b19ba32b5e2d1c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.8-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 3dff40ed30fc6834166f3cc4d4a6365f3019a9a440cb918f0c2db112f6704056
MD5 cd999e0951a9e50a215c3a54f1491519
BLAKE2b-256 dfa252ac4c6238265008eda0accfd9a757f5799af0acf13d5eb4b652d82cb3ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.8-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 db2e62899e22c8a01071d7ebad0aae844c6a0605285f077a9d71df1716e5dad7
MD5 1b75f1e88a86c3d1ba006b71e0bc8c4e
BLAKE2b-256 39e0c72e282b041b932ef7828e03c3ae9ba657211084f690bcd2e3a66b804704

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.8-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ad133e08ac724c8910388b7743adc1573678b0dd9407d98962dbbfdc5bd13f13
MD5 8e257719358041b9f932d0b4c08bed8a
BLAKE2b-256 9ce01d2319fa1368d00cbd8b366cd82d818ed278b660ecc2a2981b03e4e2870a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.8-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 f89bda80973714b6c125501cc6c42d8c17cbf22d921510b91d7ddba062063452
MD5 0ebc0a04b4dbf98de81ed8a29aa3ed96
BLAKE2b-256 3c1bc31a2d9b99eab29260406f97e49c3ba20fa965019d242bbaafca907bea08

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.8-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2f4ad568ba8f8d874c5156bf0d85d0eb8e0b0cd93ec764d3783c241834c49112
MD5 762bdff8888670117b727cc9f29aa2fd
BLAKE2b-256 26971a9dc580eaa6781c7805d76ba49e50518e63200114ad406204434947bea1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.8-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 550bf71e1cb576d0b0b8048e87eb1ccc0d44d496bf63258565864f36e9dbae2b
MD5 823cf9c5001b3543da60d40c1d6f456e
BLAKE2b-256 c5d06fb5b0777d878a4bbdea10c84328506885789379938422f2a1c87d359cc0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.8-cp39-cp39-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 254e21062010f8bc008169518878a2b559525beb77632c1ad1861fd46c76e099
MD5 7f2e50e9d7e42702c436af45719c9211
BLAKE2b-256 05e1261c180c99252ef3b1644b369f1663b278c4e3b6bd42a1abb9a66a8164cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.8-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f95b05c4cb0eccbb9c0b0491fd392606c633377819931bee5d71aad62c1cf352
MD5 fa4c253279dbacaea9eb166a06774286
BLAKE2b-256 36aa6628e6e11a698f9d771ea5ea0335388e2cf8382b0b1c3f513bca9ea19032

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.8-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 a249f2676228316393d38f64c93ecf8506e00e17b8e3e309e6609df451c7503a
MD5 540368cf937d4d9831efbb08b3f3d91d
BLAKE2b-256 227335b78f2d8aed1f0b351aacdc9fce80df3b990869e2e9a373464c395176ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.8-cp38-cp38-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 c2244e79c55483a02228742a8549c82cc7d0a8b1baf7a9b428cd4da49c6671e9
MD5 f0be9e1b603a2f405448a882c852675a
BLAKE2b-256 4f73434cc132f44a08e9650f367e28d13b41b0bfef86f107b21396dd2e9fca61

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.8-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 31583b2c906e4b01e734d6c95f1269af6b367f947a693bed3a90fb3aa78d468e
MD5 1c9226787e12addc08b1ab8d737216db
BLAKE2b-256 f4ab672a9b8a3490bcf7a75e4dbd088e9af369030a18a43254272a3f0a5fb9a0

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