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

Uploaded CPython 3.14Windows x86-64

lepton_jpeg_python-0.5.5-cp314-cp314-manylinux_2_34_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

lepton_jpeg_python-0.5.5-cp314-cp314-macosx_11_0_arm64.whl (542.1 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

lepton_jpeg_python-0.5.5-cp313-cp313-win_amd64.whl (391.5 kB view details)

Uploaded CPython 3.13Windows x86-64

lepton_jpeg_python-0.5.5-cp313-cp313-manylinux_2_34_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

lepton_jpeg_python-0.5.5-cp313-cp313-macosx_11_0_arm64.whl (542.4 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

lepton_jpeg_python-0.5.5-cp312-cp312-win_amd64.whl (379.5 kB view details)

Uploaded CPython 3.12Windows x86-64

lepton_jpeg_python-0.5.5-cp312-cp312-manylinux_2_34_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

lepton_jpeg_python-0.5.5-cp312-cp312-macosx_11_0_arm64.whl (536.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

lepton_jpeg_python-0.5.5-cp311-cp311-win_amd64.whl (380.3 kB view details)

Uploaded CPython 3.11Windows x86-64

lepton_jpeg_python-0.5.5-cp311-cp311-manylinux_2_34_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

lepton_jpeg_python-0.5.5-cp311-cp311-macosx_11_0_arm64.whl (538.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

lepton_jpeg_python-0.5.5-cp310-cp310-win_amd64.whl (380.3 kB view details)

Uploaded CPython 3.10Windows x86-64

lepton_jpeg_python-0.5.5-cp310-cp310-manylinux_2_34_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

lepton_jpeg_python-0.5.5-cp310-cp310-macosx_11_0_arm64.whl (538.9 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lepton_jpeg_python-0.5.5-cp39-cp39-win_amd64.whl (380.1 kB view details)

Uploaded CPython 3.9Windows x86-64

lepton_jpeg_python-0.5.5-cp39-cp39-manylinux_2_34_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.34+ x86-64

lepton_jpeg_python-0.5.5-cp39-cp39-macosx_11_0_arm64.whl (539.6 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

lepton_jpeg_python-0.5.5-cp38-cp38-win_amd64.whl (380.1 kB view details)

Uploaded CPython 3.8Windows x86-64

lepton_jpeg_python-0.5.5-cp38-cp38-manylinux_2_34_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.34+ x86-64

lepton_jpeg_python-0.5.5-cp38-cp38-macosx_11_0_arm64.whl (539.3 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.5-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 3c4e0224189b80cdf2d5227145a1eee73bd2203b7f2571e0e15463aaa699207f
MD5 8ceb5c897a9da8301257856a66f4931c
BLAKE2b-256 52937a57fb9c1583da498c25e487b7301cd724dd74b47fe7dc53cb3b75ff3c1a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.5-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 0bcba59398b65d7e0c6432ea8bc5066f1c791fdd6c9a6a2eca357367b2e57603
MD5 f07810622330e9e92e3a99fdf87f4f42
BLAKE2b-256 3e1305388640a5c36449072ae75e012f98088b9c7a23ad21c3996e1b8391a9f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.5-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 de7bf116eaa3c4099cd7407c8855f7c9d798e9bbd8306acd20c8db2d02069cb1
MD5 4d8c4458de5084130b87923a64217366
BLAKE2b-256 4e1a1f5240ca911c4339e5d493771608c17c13029ad8caaa6b4720b6d55f68ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 6d9a0c0e8ab84040834308e8806e4820001b83cc2d7ca1c7a95db90d1cac9b3a
MD5 741ce31a6d185f1d444e5bcf5eced0f4
BLAKE2b-256 45b75ec68647ec4e6ae058a729ec17a41e20f217ba7749d37e6e72a02b0e76f3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.5-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 9642b56ed05e74f83b2bc6edead28477256a3247f3bc746ec0cc4eef972edc7b
MD5 806813d6446e0fc3980ae82e9b56db7e
BLAKE2b-256 62f2d8ae263f1c794a665ffe32fda00a85d6c2706bdefd4d32ab5072d2b49008

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.5-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ee32634285e75f6bfcfd230156e6aec600a5f63b6a525eb7734cb45ffaa228b0
MD5 74b50246dce1745e6e6d215a48aafa68
BLAKE2b-256 b99fbd5e3c2b50eb9c48eb8ab7b92e4be93482e3f615ebed723c71b859815dbd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 db2be8910dbbbee0e72b7d9940b57215102fbe670ff4a4011a4a285dbca7c147
MD5 a6c44d6b5424efac530f568d94750dfc
BLAKE2b-256 504ec1cc2038a6c81da383bbab80272a66126dd3e4bfa70e7a05d468ed74cde2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.5-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 6fa24f44f0f18d4deeaf93ab612fde79e4e63d222208738ad851071301f01c27
MD5 427481d526d4a19c867da6a458e118e6
BLAKE2b-256 aff47d814dc378787a182a8dc975eb028c569dd87191512584728faf954648b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 55b4d29362b1b641c4a2cac18bced89433f20d3b4bac2ae39abb9a558785b823
MD5 d2c4ad8473fb09061777b081f77b986d
BLAKE2b-256 38e2a1047d254aa90dded8e88a9fd2cda751e936ddba35aa843214d862595782

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7a9efad492d40bdf7554d1b609f731efbd3b3c046eeab37169be6f54c6c33f42
MD5 ba1140228e608584aac134c4db25e11b
BLAKE2b-256 fd7503708ff9346d9a3dddbdbdaefe34f1cd8be30faf78935daa4010b9c0a9fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.5-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 740dad52bfd5166a5e5fc6943812ff914a1611809d121fc0aca5d11a8bd67f68
MD5 ca0d7e248a2755fdaaf3a96c7f5bc5ab
BLAKE2b-256 29f2303e05e20a53007191b1b1e5b9dca9cd0eea3b3d89309526e9c50e38824a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.5-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 33f66d663c8561f6dfb6f67e48e5345ef2b01ec5b7329cdfd086bb64488c00d8
MD5 3e41341bf7c1ae0683908096b9659859
BLAKE2b-256 748691a28ed6dbf3d567c15972c631dbc9401cf879364cbac81d3cf3f58f054a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d9beb5e9184475b54743f3c23f657048a722bd4776c1cfce677825ab4ca522af
MD5 4e91ffe1027f377b7f2f39a8a9edfa4d
BLAKE2b-256 582f877f7fd32d797b33e5469d4797e409526dfc2ef912713c5539d89d448134

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.5-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ef6b82316c9f8fb3fb6ddd87e5d546bfdab30d3040c24eded4112b066d694438
MD5 b822af0449f9ff608dee78dff129acf7
BLAKE2b-256 93796ec47eb48b1cb51d763280e68ca8090290e03680ecf7988992a23b0b1002

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.5-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 777b3e4a2da08f6c938d5dd60e57ec6f742cb588eee7d76d0dbbf9015161f26a
MD5 2f390bcecc899e997e3c7236efb8e4b2
BLAKE2b-256 452488c6fb8e7158cb4b339e6c6ac6f1536c4ce4dcd09c116aca012b94b0d002

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.5-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 d14852213f49cf40e963d5c8073dffcbd4fb70b4b3e58852797e703215116b46
MD5 ea14436f749e86c8f2e402adcc1e7a39
BLAKE2b-256 04afb66f824b62f37855b2dedfcd6d4b3c00d14407f15ef954f8d5f40e538f7b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.5-cp39-cp39-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 834d3dd1014670e2ee7e0b9f8540fcd161c9f5f5a59d91d1f02cb0a4cfd8af6a
MD5 28852d216292a81314d5f2924f8d78cb
BLAKE2b-256 543f55e9e1130232f5496eca656026f30151f1ccddd967db4f75dbb82342678c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.5-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 99ac100c500286ed23dcb09af0965c5fffa885292e10ef7516624d9d4700e477
MD5 4792f1f9a0767f0c3b4201fc970a6c03
BLAKE2b-256 18fadf9e8eef430bf487495156c17fd92b8440aac52ab56730c4d0def44b37a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.5-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 7ad545f484fcd09c843ced3981ac972cd45aeed1d95f72e4a6723406cac62d53
MD5 af62c517e6e12412b6dc9954efec0831
BLAKE2b-256 0c7dacdfb12c44a3090e452daf3aadae4455d7cbf7e8cc638de7839a903f7df6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.5-cp38-cp38-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 314b36aa06d3f0930c6d92902397c881cc81cb80eb267e4078a392bcdd31cadd
MD5 c2b87002bb17031d3745032cbe42f114
BLAKE2b-256 b79021754834f220fbc3b1db38f19fc0d3cc18fb2175e512e052a79dd371403b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lepton_jpeg_python-0.5.5-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 aa3dd989d4356f4c8943265a92396b7df2d5c3443cd2d8eaa1d8e5f9c59da5df
MD5 7503ea614611ecc731971896b36035f6
BLAKE2b-256 91537ecbcef2c07afdd754f1b4677243d474dd1cde061739f62c60076a50aea7

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