GithubHelp home page GithubHelp logo

alexxnica / lepton Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dropbox/lepton

0.0 1.0 0.0 52.03 MB

Lepton is a tool and file format for losslessly compressing JPEGs by an average of 22%.

Home Page: https://blogs.dropbox.com/tech/2016/07/lepton-image-compression-saving-22-losslessly-from-images-at-15mbs/

License: Apache License 2.0

CMake 1.00% Makefile 1.34% Perl 0.09% Shell 0.44% M4 0.28% C++ 95.53% HTML 0.01% JavaScript 0.39% Python 0.92%

lepton's Introduction

Lepton

Lepton is a tool and file format for losslessly compressing JPEGs by an average of 22%.

This can be used to archive large photo collections, or to serve images live and save 22% bandwidth.

Build Status

Build directions

Using a single core

./autogen.sh
./configure
make
make check

For multiprocessor machines:

./autogen.sh
./configure
make -j8
make check -j8

Using CMAKE:

mkdir -p build
cd build
cmake ..
make -j8

On Windows

mkdir -p build
cd build
"c:\Program Files\CMake\bin\cmake" ..
start .
REM Double click the Visual Studio project

Usage

To roundtrip (compress and decompress) an image, original.jpg, do the following:

./lepton original.jpg compressed.lep
./lepton compressed.lep restored_original.jpg

Or all at once:

./lepton original.jpg compressed.lep && ./lepton compressed.lep restored_original.jpg && diff restored_original.jpg original.jpg && echo no differences

Lepton may also be used with pipes -- be sure to check the exit code when using pipes as if compression fails lepton will produce 0 bytes and return a nonzero exit code (failure). In this case do not assume the 0 byte file is representative of the original.

./lepton - < original.jpg > compressed.lep
./lepton - < compressed.lep > restored_original.jpg

You may specify higher memory limits than the default for lepton to handle bigger images:

./lepton -memory=1024M -threadmemory=128M input_file output_file

Additionally you can configure lepton to process progressive jpegs. Warning: these take more memory to decode than normal JPEGs since the entire framebuffer must be kept in memory for the duration of the decompression, instead of just 2 rows of blocks.

./lepton -allowprogressive -memory=1024M -threadmemory=128M progressive.jpg compressedprogressive.lep

Submitting pull requests to lepton

Please begin by filling out the contributor form and asserting that

The code I'm contributing is mine, and I have the right to license it.
I'm granting you a license to distribute said code under the terms of this agreement.

at this page: https://opensource.dropbox.com/cla/

Then create a new pull request through the github interface

Debugging

Lepton is designed to be easy to debug, but a command line requirement is necessary to prevent the standard forks that let it do a secure verification in a separate process.

To avoid setting follow fork flags, please pass -skipverify to the command line. This will stop verification and let you debug the app as a single process application. If the bug happens in single threaded mode, also you can pass -singlethread which makes it easier to step through the code without other threads hitting breakpoints.

Bindings for other languages

Acknowledgements

Many thanks to Matthias Stirner and HTW Aalen University for the development of the uncmpJPG library.

Thanks to the VPX authors for their highly tuned bool reader and bool writer implementations.

Related Work

Be sure to read the groundbreaking research done by Matthias Stirner, Gehard Seelman and HTW Aalen University in their 2007 paper and check out their excellent PackJPG repositories for compression of JPEG MP3 BMP and PMN formats.

Also the paq algorithms combine for a highly compressed JPEG result when decompression time is less critical.

When the compressed JPEG needs to also be a JPEG, there is mozjpg to explore as well.

License

Unless otherwise noted:

Copyright (c) 2016 Dropbox, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

lepton's People

Contributors

danielrh avatar keithw avatar onyxmaster avatar krishmunot avatar alexanderfrolov avatar czchen avatar whitef0x0 avatar jas14 avatar gluon-anon avatar braincore avatar lfaraone avatar unitedmarsupials-zz avatar nwmcsween avatar nickkolpinski avatar ryancopley avatar zmwangx avatar dlemstra avatar gtuk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.