Forum moved here!

Home / “Error loading” CBZ files that were created with a batch script, worked a few weeks ago

Hanlea

Hello,
I created a few CBZ archives a while ago with a batch script and could open them with Sumatra just fine.
Now I notice that I can’t open them anymore. I think I upgraded my version to v3.2 a week or so ago. The files used to work before but I haven’t had much time to read things after I updated, so my assumption would be that the update is the cause for this.

The format of the files that are converted to CBZ doesn’t matter. (tried JPG,PNG,WEBP)

If I manually zip a folder with 7-zip and rename it to .cbz it works.
If I use the batch script that I wrote it doesn’t work anymore.

The batch is a simple:

for /d %%X in (*) do “D:\Tools\7-Zip\7z.exe” a -mx “%%X.cbz” “%%X*”

Is there some way to diagnose in more detail why it isn’t able to open the files anymore?

Thank you.

Edit:
I tried this fix [Fixed in 3.2] Error loading cbr comic files in older 3.1.2 , downloading and placing the UnRAR64.dll to the Sumatra folder, but it didn’t change anything.
And since it works with manually created cbz archives I assume the issue lies somewhere else.

GitHubRulesOK

you need to be sure of the type
the fix is not needed for 3.2 but was only for newer CBR (RAR5)
if compressed in native TAR then type=CBT Zip =CBZ for 7z they should be CB7
so which one you use needs a different CBXtension

Historically the easier multipage formats were TIF and GIF (both supported) or DCX (not supported) and could be read in any image application.

CBX is a way to containerise single images in a basic ARChive wrapper but the ARC can be ACE (CBA is not supported by SumatraPDF) or RAR TAR ZIP & 7Z however SumatraPDF expects the .CBx to be correctly named.

Of those the simplest of all is CBZ because you can select the images then rightclick to send to compressed folder (files.zip) and simply rename to .cbz
Equally simple to test if they are valid by rename a .cbz to .zip and double click to see if windows explorer opens it correctly.

Hanlea

Thank you for your answer, interesting information, although it took me a while to see how it is supposed to help me.
I can open the created archives with Windows Explorer just fine.

I tried different versions of Sumatra Portable:
Open a batch created cbz from a zip with 7-zip:

2.5.2 doesn’t work
3.0 works
3.1.2 works
3.2 x32 and x64 doesn’t work

When I simply change the target ending from .cbz to .cb7 in the batch then it works.
Maybe I misunderstood how to properly use the 7zip parameters.
Although I still wonder why my original method worked fine in versions 3.0 - 3.1.2.

Well, I guess now I have to rename a few archives… :unamused:

GitHubRulesOK

There may have been some “tightening” of “sniffing” file extensions that differed between versions but to work universally across all apps it is best to set 7zip for plain.zip format.

Many users get hung up about file size but KISS is to go with the simplest to DEcompress (modern storage is so cheap that heavy compression is counter productive)

Png’s in .zip is possibly the alround easiest for now. and SumatraPDF will open images.zip in exactly the same way with the bonus to “save as” images.pdf

GitHubRulesOK

I just tested pre-release and it has no problem opening a valid .cb7 even if it is incorrectly named as .cbz.

However 3.2 can not open it, so it is up to you to either rename or shift to pre-release.

Hanlea

After some digging in the 7-zip Help and with what GitHubRulesOK wrote I think I figured out what happened.

There is a -t switch that sets the type of archive.

If -t{archive_type} switch is not specified, 7-Zip uses extension of archive filename to detect the type of archive. If you create new archive, -t{archive_type} switch is not specified and there is no extension of archive, 7-Zip will create .7z archive.

Since I didn’t specify the switch, it created a .7z archive and then simply named it “.cbz”.
So it was exactly as GitHubRulesOK wrote, although I wasn’t aware of that at that point.

The corrected batch script looks like this:

for /d %%X in (*) do “D:\Tools\7-Zip\7z.exe” a -tzip -mmt=4 -mm=lzma -mx=0 -bt “%%X.cbz” “%%X*”
-tzip tells it to create a zip-archive.
-mmt is for the number of threads
-mm is for the compression method
-mx is the compression level

I’ll take the save route and rename my files and use the corrected batch in the future.
Thank you for your help.