2

I am wondering how to compress .cbr and .cbz files very tightly to decrease the file size.

Anonim
  • 33
  • 7
    What kind of files? Text files? Image files? Binary executable files? Videos? How "tightly"? Please [edit] your question and add some information. Also tell us which of the many compression tools you have tried and why they won't work for you. – terdon Jun 10 '20 at 14:01
  • I didn't try any tools that's why I asked here. – Anonim Jun 10 '20 at 15:06
  • 3
    Then please try some tools first. I understand this is confusing to new users, but we are not a forum, we are trying to build a collection of useful questions and answers that can help future visitors to the site. We therefore expect users to ask here after attempting to solve their issue themselves. So please try some of the existing tools (gzip, bzip2, rar, zip... just search for "compress files linux") and ask again if you are having problems with them. Also, what are cbr and cbz files? If they are what I think, they are already compressed. – terdon Jun 10 '20 at 15:16
  • @terdon thanks, my bad. :) – Anonim Jun 10 '20 at 16:12

4 Answers4

5

I am wondering how to compress .cbr and .cbz files

cbr and cbz stand for Comic Book Rar and Comic Book Zip. Those files are basically JPEGs stored in a archive with a custom extension. Since they are already compressed in a archive you cannot reduce their sizes by archive compression.

What you do can instead is to extract the images from the archive with 7z e file.cbz for example and process the JPEGs to reduce the image quality (and size) with the convert command from ImageMagick. Finally, you can rebuild your archive with the 7z utility or the zip command (or alternatively the rar command if you want .cbr files). You just need to rename your .zip files to .cbz (or your .rar files to .cbr).

1
  • resize images according to your real needs; quite often resizing down to 50% might be acceptable - this depends on source
  • if your reader software accepts it - try WebP format; if you need/have/want to stick to jpg you may still experiment with compression quality
  • compressing with zip/rar/etc. is often not worth it and zip in copy mode might be optimal
  • some source (highly compressed and/or poor quality) would be virtually incompressible without noticeable quality drop
TMSZ
  • 111
  • Why does compression, isn't worth it? And making a fast copy "optimal". What made you think that way? – Satoshi Nakamoto Mar 08 '22 at 09:53
  • Using lossless compression (e.g. zip deflate) on already compressed images is not reducing size in a meaningful way (~2%). At the same time it slightly slows access to images which might be important for low power mobile readers (this probably would be not significant for deflate but might be quite annoying for solid compression). – TMSZ Nov 18 '23 at 22:07
0

gzip -9

gzip would be available for whatever linux distribution you are using... redhat/centos, fedora, suse, debian, ubuntu, mint, whatever. Giving that the -9 option would mean max, do a man gzip to read more.

You are basically asking about file compression software and there are many, each having pro's and con's, some better than others for various reasons.

Possibly the best might be 7-zip, but you would have to install it as it usually does not come automatically installed as one of the base software programs in linux, and then you would need to understand which compression algorithm to choose and what settings on that to use as well... I defer you to google on that.

Various compression software/methods off top of my head you could web search on are

  • zip
  • gzip
  • bzip2
  • 7-zip
  • xz
  • lzma

The other big thing is you ask, How to compress any file very tightly? It doesn't work like that, some files (which is fundamentally data) are already compressed natively and will not compress any more regardless of which compression algorithm you chose. Not significantly anyway, so to a large extent you need to understand (a) what you want to compress and (b) what compression algorithm would be the best choice for whatever reasons to use on it.

ron
  • 6,575
0

Try this python script that I wrote:

https://github.com/tsaost/resizecbz

If you are on Windows there is also an executable: https://github.com/tsaost/resizecbz/releases

You have to look for it under “Assets”

tst
  • 101