Page 1 of 2 12 LastLast
Results 1 to 30 of 31

Thread: Lepton image compression

  1. #1
    Member
    Join Date
    Aug 2008
    Location
    Planet Earth
    Posts
    772
    Thanks
    63
    Thanked 270 Times in 190 Posts

    Lepton image compression

    Lepton achieves a 22% savings reduction for existing JPEG images, by predicting coefficients in JPEG blocks and feeding those predictions as context into an arithmetic coder:

    https://blogs.dropbox.com/tech/2016/...ages-at-15mbs/

    https://github.com/dropbox/lepton

  2. The Following 3 Users Say Thank You to Sportman For This Useful Post:

    Bulat Ziganshin (31st August 2016),ne0n (15th July 2016),Shelwien (15th July 2016)

  3. #2
    Member
    Join Date
    Sep 2007
    Location
    Denmark
    Posts
    856
    Thanks
    45
    Thanked 104 Times in 82 Posts
    This is kind of a PackJPG alternative ?

  4. #3
    Member
    Join Date
    Mar 2016
    Location
    Croatia
    Posts
    181
    Thanks
    74
    Thanked 10 Times in 10 Posts
    @SvenBent

    that was my first thought as well.
    I wonder is it, and how much better than PackJPG.

  5. #4
    Administrator Shelwien's Avatar
    Join Date
    May 2008
    Location
    Kharkov, Ukraine
    Posts
    3,134
    Thanks
    179
    Thanked 921 Times in 469 Posts
    http://nishi.dreamhosters.com/u/lepton20160715.exe

    "Copyright (c) 2006...2016, Matthias Stirner and HTW Aalen University"

  6. #5
    Member
    Join Date
    Sep 2007
    Location
    Denmark
    Posts
    856
    Thanks
    45
    Thanked 104 Times in 82 Posts
    Code:
    D:\Comics>lepton20160715.exe oots1039.jpg
    lepton v1.0-unknown
    Input Size 722436 != Roundtrip Size 0
    52ea3834807742744a7cb6d040592c4f != 8cadf6b0feffffffb8733a00df343200
    ROUNDTRIP_FAILURE
    
    D:\Comics>lepton20160715.exe oots1039.jpg

  7. #6
    Administrator Shelwien's Avatar
    Join Date
    May 2008
    Location
    Kharkov, Ukraine
    Posts
    3,134
    Thanks
    179
    Thanked 921 Times in 469 Posts
    That's probably why there's the zlib alternative. But its a packjpg version anyway.
    Also did you try -allowprogressive ?

  8. #7
    Member
    Join Date
    Sep 2007
    Location
    Denmark
    Posts
    856
    Thanks
    45
    Thanked 104 Times in 82 Posts
    Quote Originally Posted by Shelwien View Post
    That's probably why there's the zlib alternative. But its a packjpg version anyway.
    Also did you try -allowprogressive ?
    Nope the jpeg was not progressive but i might try tonight.
    i was just unsure if the command line i did was correct or not

  9. #8
    Member
    Join Date
    Apr 2009
    Location
    here
    Posts
    202
    Thanks
    165
    Thanked 109 Times in 65 Posts
    so what does this do better than packjpg/packarc?

    it does not compress better in my quick test, it might be faster, i can't test this right now.

    it is hard to test it seems, with bigger files i get

    lepton v1.0-unknown
    Input Size 60934961 != Roundtrip Size 0
    ceef1e51a728fcf9cf6cf97d95ffff33 != f9c3e628feffffffb873e000df34d800
    ROUNDTRIP_FAILURE
    and due to the fact it cannot handle wildcards, only small files can be tested. not very reliable.

    /edit: ok, it IS faster, packjpg only uses 1 core.

    too bad this here can't be compiled using mingw/gcc

  10. #9
    Member
    Join Date
    Sep 2007
    Location
    Denmark
    Posts
    856
    Thanks
    45
    Thanked 104 Times in 82 Posts
    #8
    Thats the same error i got. so ts an jpeg input size issue ?

  11. #10
    Member
    Join Date
    Jul 2016
    Location
    Russia
    Posts
    21
    Thanks
    13
    Thanked 7 Times in 6 Posts
    Original: 2000x3000 (6.00 MPixels) 19602KB [PNG-lossless]

    Save as - JPEG, progressive, quality 60, subsampling 2x2(4:2:0) - 488KB
    Lepton - 388KB (compress 20.5%)
    WebP - 386KB (cwebp 0.5.1)
    Jpeg2000 - 382KB (OpenJPEG 2.1.1)
    BPG - 398KB (0.9.6, x265)

    With forced subsampling 2x2 (4:2:0) in all formats.

    Original: http://i023.radikal.ru/1607/6f/f2778e49dea4.png
    Jpeg+Lepton http://s002.radikal.ru/i198/1607/7d/5607596e5734.png
    WebP http://s013.radikal.ru/i324/1607/7f/d0e72e4269d9.png
    Jpeg2000 http://s008.radikal.ru/i303/1607/3e/b1c969879ae4.png
    BPG http://s017.radikal.ru/i427/1607/23/178a23eb312d.png

    Full-Size: https://cloud.mail.ru/public/KxdX/6wSPKH9HW

  12. #11
    Member
    Join Date
    Jun 2015
    Location
    Switzerland
    Posts
    667
    Thanks
    204
    Thanked 241 Times in 146 Posts
    Quote Originally Posted by zubzer0 View Post
    Original: 2000x3000 (6.00 MPixels) 19602KB [PNG-lossless]
    At quality 85 WebP [683 kB] removes freckles (blurring), at quality 75 jpeg [691 kB] adds more freckles (ringing, block boundaries). Cloth looks better on the WebP, but skin and hair looks better on Jpeg.

  13. #12
    Tester
    Stephan Busch's Avatar
    Join Date
    May 2008
    Location
    Bremen, Germany
    Posts
    872
    Thanks
    457
    Thanked 175 Times in 85 Posts
    Lepton is based on UncmpJPG sources of Matthias Stirner. It does work like packJPG but doesn't use its sources.

    Can someone please create a batch file for windows so that multiple files or whole folders can be processed with Lepton?

    In my intial tests Lepton is 3x faster than packJPG: the slow-best-ratio variant is about 2x faster.
    Compression is sometimes better than packJPG, sometimes worse. To run executables in commandline I had to use
    -skipverify switch to make it run with timer. It also compresses large JPEG - therefore I used -memory=1600M switch.
    On some JPEG it crashes without warning, but the authors are kind and they are working on it.
    I have also asked the author if wildcard support could be added but he told he needs help to make that happen,
    so I created an issue in GitHub.

  14. #13
    Member
    Join Date
    Sep 2015
    Location
    Italy
    Posts
    216
    Thanks
    97
    Thanked 128 Times in 92 Posts
    Quote Originally Posted by Stephan Busch View Post
    Can someone please create a batch file for windows so that multiple files or whole folders can be processed with Lepton?
    I don't know how to use Lepton (just see some examples), however I think that it could be enough something like this.

    Line to be copied in a batch file (in this simple way you can pass up to 9 wildcards):
    @for %%i in (%1 %2 %3 %4 %5 %6 %7 %8 %9) do @lepton "%%~i" "%%~i.lep"

    Call the batch (e.g. WildLep.bat):
    WildLep [Folder_To_Read\]Wildcard [...]

    Folder_To_Read: optional (default: current folder), it is the folder where are the files.
    Wildcard: obligatory, it can be a file name (e.g. file1), a file name with wildcard (file*), a list of the previous ones (file1 "file with space in the folder or name" a* b??? c\d*.e f\*)

    Some examples:
    WildLep *
    WildLep "\test folder\file*" another_folder\only_one_file

    You can execute this "for" also in the command line, replacing %% with %:
    for %i in (*) do lepton "%~i" "%~i.lep"
    for %i in ("\test folder\file*" another_folder\only_one_file) do lepton "%~i" "%~i.lep"

  15. The Following User Says Thank You to Mauro Vezzosi For This Useful Post:

    Stephan Busch (29th July 2016)

  16. #14
    Member
    Join Date
    Sep 2007
    Location
    Denmark
    Posts
    856
    Thanks
    45
    Thanked 104 Times in 82 Posts
    for /D %i in (*.jpg) do Lepton.exe <commands> %i

    let it rip

  17. The Following User Says Thank You to SvenBent For This Useful Post:

    Stephan Busch (29th July 2016)

  18. #15
    Member
    Join Date
    Sep 2015
    Location
    Italy
    Posts
    216
    Thanks
    97
    Thanked 128 Times in 92 Posts
    Quote Originally Posted by SvenBent View Post
    for /D %i in (*.jpg) do Lepton.exe <commands> %i

    let it rip
    - /D uses *.jpg as folder name, not file name, perhaps did you mean to write /R (recurse into subfolders)?
    - %i works in command line, in batch file (as requested by Stephan) you must write %%i.
    - I think that %i (and %%i) doesn't handles file names with space in the right way, e.g. for file names "test_file_1.jpg" and "test file 2.jpg":
    Code:
    %i    -> Lepton.exe <commands>  test_file_1.jpg  <--  test_file_1.jpg   is 1 parameter 
    "%~i" -> Lepton.exe <commands> "test_file_1.jpg" <-- "test_file_1.jpg"  is 1 parameter
    %i    -> Lepton.exe <commands>  test file 2.jpg  <--  test file 2.jpg  are 3 parameters
    "%~i" -> Lepton.exe <commands> "test file 2.jpg" <-- "test file 2.jpg"  is 1 parameter
    Last edited by Mauro Vezzosi; 29th July 2016 at 10:09. Reason: Replaced "%%~i" with "%~i" in the examples

  19. The Following User Says Thank You to Mauro Vezzosi For This Useful Post:

    Stephan Busch (29th July 2016)

  20. #16
    Member
    Join Date
    Oct 2014
    Location
    South Africa
    Posts
    38
    Thanks
    23
    Thanked 7 Times in 5 Posts
    The commandline parsing has a problem.


    Code:
    lepton a.jpg a.tmp
    lepton v1.0-08c52d9280df3d409d9246df7ff166dd94628730
    Failed To start subprocess with command line OS_ERROR
    It must be lepton.exe. Please fix this bug, otherwise it cannot be used by FreeArc !

  21. #17
    Tester
    Stephan Busch's Avatar
    Join Date
    May 2008
    Location
    Bremen, Germany
    Posts
    872
    Thanks
    457
    Thanked 175 Times in 85 Posts
    I am using this bat - not for drag & drop, but for commandline:

    echo off
    @for %%i in (%1 %2 %3 %4 %5 %6 %7 %8 %9) do @lepton-slow-best-ratio -skipverify "%%~i" "%%~i.lep"

    pause

    then I am using this commandline:

    lepton.bat *.jpg

  22. #18
    Member
    Join Date
    Sep 2007
    Location
    Denmark
    Posts
    856
    Thanks
    45
    Thanked 104 Times in 82 Posts
    No need to put @ in front of the for line when you already have echo off, but you could but @ in front of the echo off command to hide it as well.
    If you are only doing on line in you batch if would just remove the echo off and keep the @ before the for line to keep the bat as small as possible.

  23. #19
    Member
    Join Date
    Aug 2014
    Location
    Argentina
    Posts
    464
    Thanks
    202
    Thanked 81 Times in 61 Posts
    Hi folks! Quick thoughts:

    1) I got an error on Windows 7 32 bits, using both the binary provided above and a build of my own of the last sources:
    Code:
    Failed To start subprocess with command line OS_ERROR
    Any ideas?
    2) On 'optimized' images (i.e. ECT) lepton performs actually better than PackJpg (compresses more densely)... Maybe later I can run again the tests so we can see the actual numbers.
    3) Lepton is not case sensitive. On Linux this is an issue.
    "lepton IMAGE.JPG" produces IMAGE.lep
    "lepton IMAGE.lep" produces IMAGE.jpg
    4) Can anybody help me doing parallel batches for linux? Like using ppx2 on Windows... Thank you in advance! This would be useful to compare PackJpg vs Lepton speed using all CPU resources.

  24. #20
    Member
    Join Date
    Jul 2016
    Location
    Russia
    Posts
    21
    Thanks
    13
    Thanked 7 Times in 6 Posts
    Hello,
    Please help in assembling last commit, that was support processors below SSE4
    https://github.com/dropbox/lepton

  25. #21
    Administrator Shelwien's Avatar
    Join Date
    May 2008
    Location
    Kharkov, Ukraine
    Posts
    3,134
    Thanks
    179
    Thanked 921 Times in 469 Posts
    It builds really easily from the list of *.c* files: http://nishi.dreamhosters.com/u/lepton20170214.exe
    If that's what you meant.

  26. The Following 2 Users Say Thank You to Shelwien For This Useful Post:

    RamiroCruzo (15th February 2017),zubzer0 (15th February 2017)

  27. #22
    Member
    Join Date
    Jul 2016
    Location
    Russia
    Posts
    21
    Thanks
    13
    Thanked 7 Times in 6 Posts
    Shelwien
    Thanks! On SSE3 (Core2Quad Q6600) works!
    This very fast compression jpeg, and not bad results

  28. #23
    Tester
    Stephan Busch's Avatar
    Join Date
    May 2008
    Location
    Bremen, Germany
    Posts
    872
    Thanks
    457
    Thanked 175 Times in 85 Posts
    Would someone please post a win64 compile of latest Lepton?

  29. #24
    Member
    Join Date
    Jun 2015
    Location
    Switzerland
    Posts
    667
    Thanks
    204
    Thanked 241 Times in 146 Posts
    Would a JPEG recompression system that is 2.5x faster in (de)compression but 2 % worse density be more or less interesting than Lepton?

  30. #25
    Tester
    Stephan Busch's Avatar
    Join Date
    May 2008
    Location
    Bremen, Germany
    Posts
    872
    Thanks
    457
    Thanked 175 Times in 85 Posts
    I guess it would be interesting as well.

  31. #26
    Member
    Join Date
    Mar 2016
    Location
    Croatia
    Posts
    181
    Thanks
    74
    Thanked 10 Times in 10 Posts
    Quote Originally Posted by Jyrki Alakuijala View Post
    Would a JPEG recompression system that is 2.5x faster in (de)compression but 2 % worse density be more or less interesting than Lepton?
    Honestly, since i mostly use images for storage or serving from web pages, i would prefer maximum possible compatible compression, no matter how long it takes in time or computing power......but decompression is another story, needs to be fast.

  32. #27
    Member
    Join Date
    Mar 2016
    Location
    Croatia
    Posts
    181
    Thanks
    74
    Thanked 10 Times in 10 Posts
    Did anyone try to compare gueztli and lepton?

  33. #28
    Member
    Join Date
    Jun 2015
    Location
    Switzerland
    Posts
    667
    Thanks
    204
    Thanked 241 Times in 146 Posts
    Quote Originally Posted by dado023 View Post
    Did anyone try to compare gueztli and lepton?
    Guetzli and lepton are complementary, i.e., it is possible to compare: libjpeg vs. guetzli vs. libjpeg+lepton vs. guetzli+lepton.

    Guetzli should generate slightly less homogeneous entropy models, so further compression is likely going to be slightly less effective. I never actually tried lepton, but from a statistical viewpoint I'd assume you would get 14-17 % recompression for guetzlified images and the usual 22 % for libjpeg images.

  34. #29
    Member
    Join Date
    Mar 2016
    Location
    Croatia
    Posts
    181
    Thanks
    74
    Thanked 10 Times in 10 Posts
    Quote Originally Posted by Jyrki Alakuijala View Post
    Guetzli and lepton are complementary, i.e., it is possible to compare: libjpeg vs. guetzli vs. libjpeg+lepton vs. guetzli+lepton.

    Guetzli should generate slightly less homogeneous entropy models, so further compression is likely going to be slightly less effective. I never actually tried lepton, but from a statistical viewpoint I'd assume you would get 14-17 % recompression for guetzlified images and the usual 22 % for libjpeg images.

    Ok, so i am a bit confused....so, lepton is JPG compatible, correct?

    How does jpeg-archive come into all this? cant it be combined for even smaller file sizes?
    Last edited by dado023; 17th March 2017 at 04:51.

  35. #30
    Member
    Join Date
    Dec 2014
    Location
    Berlin
    Posts
    29
    Thanks
    35
    Thanked 26 Times in 12 Posts
    It is not compatible, lepton is a container format for JPEG files

  36. The Following 2 Users Say Thank You to pothos2 For This Useful Post:

    dado023 (17th March 2017),Jyrki Alakuijala (18th March 2017)

Page 1 of 2 12 LastLast

Similar Threads

  1. UCI Image Compression
    By maadjordan in forum Data Compression
    Replies: 5
    Last Post: 19th August 2017, 23:15
  2. Image compression for microcontroller
    By branislav in forum Data Compression
    Replies: 6
    Last Post: 16th November 2015, 23:24
  3. Lossy image compression article
    By nburns in forum Data Compression
    Replies: 1
    Last Post: 20th October 2013, 19:20
  4. Bitonal image compression and interlacing
    By Karhunen in forum Data Compression
    Replies: 2
    Last Post: 6th November 2012, 05:08
  5. 3d image compression
    By m^2 in forum Data Compression
    Replies: 5
    Last Post: 9th July 2012, 08:52

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •