C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
It can enhance the compression ratio of your GZIP, ZIP, or PNG files that use the DEFLATE compression algorithm. We use the free DeflOpt.exe command-line executable to do this.
Example. First we note that even after the highest compression from 7-Zip or other tools, DeflOpt.exe can often reduce your file size by one or more bytes. This tool is written by Ben Jos Walbeehm and is available from his site.
Note: DeflOpt "optimizes the structures created by deflate programs and then recodes the files using those optimized structures."
Windows command line for Deflopt deflopt.exe C:\yourfolder
To test the program on many files, I created a method in the C# programming language that runs the DeflOpt.exe program against an entire directory. Above you can see the command line for running DeflOpt.exe on a directory.
And: The DeflOpt.exe file should be in your current directory when you run that. Here is the C# code I use to automate this command.
Method that executes Deflopt.exe: C# /// <summary> /// Run DEFLOPT on compressed files directory /// Improves compression ratios minutely /// </summary> public static void CompressDirDeflopt(string dir) { ProcessStartInfo p = new ProcessStartInfo(); p.FileName = Locations.DefloptExe; // Location of DeflOpt.exe p.Arguments = string.Format("{0}", Quote(dir)); p.WindowStyle = ProcessWindowStyle.Hidden; using (Process x = Process.Start(p)) { x.WaitForExit(); } } /// <summary> /// Surround string with quotes /// </summary> static string Quote(string s) { return "\"" + s + "\""; }
Results. When I run the command on a directory of 296 files with the maximum GZIP compression in 7-Zip, 17 of them are rewritten for a total savings of 17 bytes. That is a total savings of 0.0000164%.
However: If I use a lower initial setting in 7-Zip, I get a savings of 147 bytes, around 10 times as much, which is still tiny.
Summary. We saw that the results with DeflOpt.exe are less than stunning. But if you are already using it, DeflOpt is sometimes worth keeping, depending on your goals. If you are into compression, it is an interesting tool.
Also: You can use it on PNG and ZIP files, which I didn't test here. Experiment with it and see how it works on your project.
Programs written by Ben Jos Walbeehm