NeRdTheNed / deft4j

WIP deflate toolkit for Java
BSD Zero Clause License
7 stars 0 forks source link
apng compression deflate deflate-compression gzip image-compression image-optimisation image-optimization java optimization png png-compression png-compressor zip zlib

deft4j

WIP deflate toolkit for Java.

deft4j is a (very inefficient) deflate stream parser and optimiser.

It has support for parsing and writing ZIP, GZip, ZLib, and PNG files (including APNG and most deflate compressed PNG chunks).

deft4j implements a few deflate stream optimisations:

Future work includes:

deft4j also includes options for recompressing files with various libraries, including CafeUndZopfli.

Usage

deft4j is currently available as a command line application:

Usage: deft4j optimise [-hrV] [-f=<format>] [-m=<recompressMode>] <inputFile>
                       <outputFile>
Deflate stream optimiser
      <inputFile>         The file to optimise
      <outputFile>        The optimised file
  -f, --format=<format>   File format
  -h, --help              Show this help message and exit.
  -m, --mode, --recompress-mode=<recompressMode>
                          Enable various levels of recompression. Valid values:
                            NONE, CHEAP, ZOPFLI, ZOPFLI_EXTENSIVE,
                            ZOPFLI_VERY_EXTENSIVE
  -r, --raw               Ignore file format, treat input as a raw deflate
                            stream
  -V, --version           Print version information and exit.

Credits

The code for parsing and writing deflate streams is based on hwzip, which is in the public domain. The code for Huffman encoding and decoding is largely from deflate-impl, which is licensed under the MIT license.

License

All original code is licensed under the BSD Zero Clause License. The code for Huffman encoding and decoding is licensed under its original terms of the MIT license.