How to set 7z compression level using GUI in Ubuntu?

10,973

My idea was to find some hint in the file listing of the packages or in gconf, but I had no luck. Someone else knew the answer though.

Superuser: Change default compression levels for file-roller?

Either:

$ dconf write /org/gnome/file-roller/general/compression-level "'maximum'"

Or:

$ dconf-editor
  1. Select org in the left-hand pane.
  2. Select gnome in the left-hand pane.
  3. Select file-roller in the left-hand pane.
  4. Select general in the left-hand pane.
  5. Select compression-level in the right-hand pane.
  6. Set compression-level to 'maximum'.

Unfortunately, you cannot fine-tune this setting for different compression programmes. If you want all the freedom, you can use your shell instead.

Image of dconf Editor with file-roller's compression-level set to maximum..

That answer previously had no upvotes, so I checked if this has any effect at all and choose to compress some documents with the default settings and with maximum settings (type 7z). Result: 2,3 KB improvement on a ~300 KB archive.

Caution:

  • Depending on the content it can have a negative impact to compress everything with LZMA/LZMA2 on level maximum. PNGs for example are already compressed with Deflate and won't gain much from compression. It would make more sense to optimize them with PNGOUT/OptiPNG, Zopfli and then archive them with LZ4, achieving faster archive decompression and reducing file size.

I tried to find out more through file-rollers manpage and user manual, still no luck. Then I dowloaded the source package and searched for "maximum" in fr-command-7z.c (note how I avoid to say I read the source), which gave me the following:

switch (archive->compression) {
case FR_COMPRESSION_VERY_FAST:
    fr_process_add_arg (command->process, "-mx=1");
    break;
case FR_COMPRESSION_FAST:
    fr_process_add_arg (command->process, "-mx=5");
    break;
case FR_COMPRESSION_NORMAL:
    fr_process_add_arg (command->process, "-mx=7");
    break;
case FR_COMPRESSION_MAXIMUM:
    fr_process_add_arg (command->process, "-mx=9");
    if (! _g_mime_type_matches (archive->mime_type, "application/zip")
        && ! _g_mime_type_matches (archive->mime_type, "application/x-cbz"))
    {
        fr_process_add_arg (command->process, "-m0=lzma2");;
    }
    break;
}

That's as far as I can currently get, it seems like there is no ultra setting.

Share:
10,973

Related videos on Youtube

Rohith Madhavan
Author by

Rohith Madhavan

Electronics Engineering Student, VIT University. Crazy about Open Source Software and Tech Stuff.

Updated on September 18, 2022

Comments

  • Rohith Madhavan
    Rohith Madhavan over 1 year

    Archive Manager, or file-roller, doesn't seem to have the option to set the compression level for 7z files.

    enter image description here

    However, the windows client 7-zip has an option to do so using GUI -

    enter image description here

    On Ubuntu/Linux, one can set the compression level in the command line (CLI) using the -m flag. For details, refer to this answer.

    Is there any provision for setting the compression level for 7z archives using GUI in Ubuntu?

    • Admin
      Admin over 9 years
      To the best of my knowledge, it uses the ultra level, by default!
    • Admin
      Admin over 9 years
      @blade19899 The default level is 5 (Normal)
    • Admin
      Admin over 9 years
      You schooled me. The only option is by using the commandline version. And submit a feature request! To the best of my knowledge :)
    • Admin
      Admin over 9 years
      I think it's about the same algorithm as xz normally uses, and the higher compression levels could require "several gigabytes" of ram (so says man xz) - It's not like zip where specifying "max" all the time is the best idea.
    • Admin
      Admin over 9 years
      That depends on the size of the files to be archived. For practical purposes, the RAM requirement is not much of an issue.
  • Rohith Madhavan
    Rohith Madhavan over 9 years
    Although the method suggested may improve the compression levels, it requires the user to change values in the dconf-editor each time a different level is required. Is there any method where the compression levels are selected dynamically?
  • Rohith Madhavan
    Rohith Madhavan over 9 years
    +1 for the answer. Although it does not exactly solve the problem, it provides an alternative solution.
  • Csabi Vidó
    Csabi Vidó over 9 years
    @RohithMadhavan I understand what you mean. I'm trying not to blame anyone here, but I think that is how default Gnome applications are intended to work: you can enable hidden features but you won't find a lot of checkboxes and dropdown menus.
  • Rohith Madhavan
    Rohith Madhavan over 9 years
    I guess you are right. I may try to file a feature request, maybe to be included under advanced options. Thanks :-)
  • phil294
    phil294 over 3 years
    This answer also seems to work on ArchLinux, where the default compression level in file-roller already is 'maximum'. Setting to 'fast' makes it behave like -mx=5 which is the cli default.