还原时加 -o 指定输出名,否则会直接覆盖同名原文件;-cn 模式产出的文件比原文件更大,需再交给 LZMA2 等更强算法压缩才有收益;JPG/MP3 处理依赖内置的 brunsli、packJPG、packMP3 等第三方库,自行编译时需一并构建
precomp silesia.zipREADME 未说明硬件要求,仅提供 Windows 和 Linux 的官方二进制与源码构建方式
命令行预压缩工具,能把已压缩文件再压小一圈,适合做归档和极限压缩
对已压缩文件(JPG、GIF、MP3、PDF 等)做二次无损压缩的命令行工具,能进一步缩小体积。
核心能力
- 解压 Deflate/zLib 流并验证可比特级还原后再重新压缩
- 支持 PDF、PNG、ZIP、GIF、JPG、MP3、bZip2 等格式
- 输出 LZMA2 压缩的 .pcf 文件,或用 -cn 输出可交给更强压缩器的数据
- 用 -r 参数从 .pcf 还原出与原文件比特一致的结果
- Windows 与 Linux/macOS 版本生成的 PCF 文件可互换
容易踩的坑
- v0.4.7最新正式版2019-02-22 · 2019-02-22 14:24 UTC
- Merge with the excellent preflate library to support recompression of all zLib streams - thanks to Dirk Steinke
- Support lzma filters (
-lf) for improved compression of executables, audio and structured data (issue #75) - Support for zLib streams larger than 2 GB (see issue #65)
- Changed to CMake for easier builds
- Fixed crashes when running multiple instances of Precomp in the same directory (see issue #87)
- Corrected
-pdfbmpstatistics (see issue #27) - Discard insufficient partial bZip2 matches (see commit https://github.com/schnaader/precomp-cpp/commit/138c1075435e6e1f40e21d0eb6d4133ac7f28841) - thanks to Gonzalo Muñoz
- Several minor bugs and memory leaks fixed (thanks to Gonzalo Muñoz and Dirk Steinke)
- v0.4.62017-09-08 · 2017-09-08 05:10 UTC
查看更新说明
- Using liblzma for on-the-fly compression (-cl) - thanks to sftt
- Reduced temporary files usage
- Much faster intense and brute mode
- Intense and brute mode can be combined now for best results
- Smoother progress indicator, second progress indicator in lzma mode
- Flag -e to preserve file extension (file.ext => file.ext.pcf instead of file.pcf) - thanks to guptaprince
- JPG detection faster and more reliable - thanks to Márcio Pais
- Updated zlib to 1.2.11
- Show Precomp version together with OS type (Linux/Windows) and 32/64 bit information
- Fixed crashes on certain files (Issue #52, Issue #59)
- Fixed incorrect restoration of a PNG multi file (Issue #50)
- v0.4.52016-05-08 · 2016-05-08 09:23 UTC
查看更新说明
- Updated packJPG to 2.5k, packMP3 to 1.0g (Issue #33)
- Windows version compiled using GCC/G++ 5.3.0 (before: 4.8.1)
- 32-bit and 64-bit versions (~10-20% faster on 64-bit machines)
- SWF support adjusted to newer versions (Issue #31)
- MP3 support (Issue #18)
- MP3 and JPG recompression without temporary files for sizes up to 64 MB (also see Issue #14)
- Fixed memory corruption in packJPG that led to crashes (Issue #17)
- Fixed Base64 streams not being restored correctly in recursion (Issue #36)
- Also see closed issue list
- v0.4.42016-01-24 · 2016-01-24 14:07 UTC
查看更新说明
- First open source release
- Updated libraries (packJPG, zLib, bZip2)
- Conversion switch -n reports filesize now
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Precomp
What is Precomp?
Precomp is a command line precompressor that can be used to further compress files that are already compressed. It improves compression on some file-/streamtypes - works on files and streams that are compressed with zLib or the Deflate compression method (like PDF, PNG, ZIP and many more), bZip2, GIF, JPG and MP3. Precomp tries to decompress the streams, and if they can be decompressed and "re-"compressed so that they are bit-to-bit-identical with the original stream, the decompressed stream can be used instead of the compressed one.
The result of Precomp is either a smaller, LZMA2 compressed file with extension .pcf (PCF = PreCompressedFile) or, when using -cn, a file containing decompressed data from the original file together with reconstruction data. In this case, the file is larger than the original file, but can be compressed with any compression algorithm stronger than Deflate to get better compression.
Since version 0.4.3, Precomp is available for Linux/*nix/macOS, too. The different versions are completely compatible, PCF files are exchangeable between Windows/Linux/*nix/macOS systems.
Usage example
| Command | Comment |
|---|---|
wget http://mattmahoney.net/dc/silesia.zip (or download from here) | We want to compress this file (the Silesia compression corpus). Size: 67,633,896 bytes (100,0%) |
7z a -mx=9 silesia.7z silesia.zip | Compressing with 7-Zip LZMA2, setting "Ultra". Size: 67,405,052 bytes (99,7%) |
precomp silesia.zip | Compressing with Precomp results in silesia.pcf. Size: 47,122,779 bytes (69,7%) |
precomp -r -osilesia.zip_ silesia.pcf | This restores the original file to a new file named silesia.zip_. Without the -o parameter, Precomp would decompress to silesia.zip. |
diff -s silesia.zip silesia.zip_ | Compares the original file to the result file, they're identical |
How can I contribute?
- You can have a look at the Issue list
- If you are looking for easy issues that don't require deeper understanding of the whole project, look for issues with the
low hanging fruitstag
- If you are looking for easy issues that don't require deeper understanding of the whole project, look for issues with the
- You can build the project or download the binaries (see below), run it on your system and report bugs or make enhancement proposals.
Releases/Binaries
Official GitHub releases for both Windows and Linux.
Alternative binary download of the latest official release for both Windows and Linux.
Binaries for older version can be found at this Google Drive folder.
Contact
Christian Schneider
Donations
To donate, you can either use the donate button here, the one at the top of the page ("Sponsor") or the one on my homepage. You can also send bitcoins to
1KvQxn6KHp4tv92Z5Fy8dTPLz4XdosQpbz
Credits
Thanks for support, help and comments:
- Stephan Busch (Squeeze Chart Author, http://www.squeezechart.com)
- Werner Bergmans (Maximum Compression Benchmark Author, http://www.maximumcompression.com)
- Matthias Stirner (packJPG, packMP3, https://github.com/packjpg, http://www.matthiasstirner.com)
- Mark Adler (http://www.zlib.net)
- Matt Mahoney (http://www.mattmahoney.net)
- Malcolm Taylor (http://www.msoftware.co.nz)
- Simon Berger (helped to fix many bugs)
- The whole encode.su forum (https://encode.su/)
Legal stuff
- brunsli (https://github.com/google/brunsli) by Google LLC is used for compression/decompression of JPG files.
- brotli (https://github.com/google/brotli) by the Brotli Authors is used for compression/decompression of JPG metadata.
- packJPG v2.5k (https://github.com/packjpg/packJPG) by Matthias Stirner is used for compression/decompression of JPG files.
- packMP3 v1.0g by Matthias Stirner is used for compression/decompression of MP3 files.
- bZip2 1.0.6 (http://www.bzip.org) by Julian Seward is used for compression/decompression of bZip2 streams.
- zLib 1.2.11 (http://www.zlib.net) by Jean-loup Gailly and Mark Adler is used for compression/decompression of zLib streams.
- GifLib 4.1.4 (http://sourceforge.net/projects/giflib) is used for compression/decompression of GIF files. The GIFLIB distribution is Copyright (c) 1997 Eric S. Raymond
- liblzma from XZ Utils 5.2.3 (http://tukaani.org/xz) is used for compression/decompresson of lzma streams.
- preflate v0.3.5 (https://github.com/deus-libri/preflate) by Dirk Steinke is used to create and use reconstruction information of deflate streams
License
Copyright 2006-2021 Christian Schneider
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.