CB7 (Comic Book 7z archive)
| Full name | Comic Book 7z archive |
|---|---|
| Extensions | .cb7 |
| MIME type | application/x-cb7 (not registered with IANA) |
| Type | container (7z archive of images) |
| Starts with | 37 7A BC AF 27 1C (7z\xBC\xAF\x27\x1C) |
| Specification | no formal spec; container is 7z (7-Zip documentation), metadata is ComicInfo.xml |
| Maintained by | no owner (de facto standard); 7z format by Igor Pavlov (7-Zip) |
| License | open; 7z and LZMA are public domain or LGPL in 7-Zip |
A CB7 file is a 7z archive that holds the pages of a comic book as image files, usually JPEG or PNG. A reader opens the archive, sorts the image names and shows them in that order. Rename it to .7z and 7-Zip extracts it.
CB7 is much less common than CBZ and CBR. LZMA2 compression doesn’t shrink JPEG or PNG pages noticeably, and 7z archives are solid by default, which makes opening a single page slow. Most comic readers support it; some e-readers and comic servers don’t.
When to use CB7#
- Use only to read existing files.
- Use if pages are uncompressed (BMP, TIFF, raw PNG with poor compression): LZMA2 can then save a lot. Re-encoding pages to PNG or WebP and using CBZ usually saves more.
- Avoid for new comics: CBZ is supported everywhere and allows fast random access.
- Avoid solid archives for reading: a reader must decompress all pages before page N to show page N.
File structure#
A CB7 is a 7z archive. The page and metadata rules are the same as for CBZ: every image entry is a page, pages are sorted by name (natural sort in most readers), the first page is the cover, and an optional ComicInfo.xml carries metadata. See CBZ file structure for the rules, the sort-order pitfalls and the ComicInfo.xml schema.
Akira v01.cb7
├── ComicInfo.xml optional metadata
├── 0001.png cover
├── 0002.png
└── ...
A 7z file starts with a 32-byte signature header that points to the end header. The packed streams come first; the header with the list of files, sizes and compression settings is at the end of the file (and is often itself compressed).
37 7A BC AF 27 1C signature "7z\xBC\xAF\x27\x1C"
00 04 format version 0.4
xx xx xx xx CRC-32 of the next 20 bytes
xx xx xx xx xx xx xx xx offset of the end header
xx xx xx xx xx xx xx xx size of the end header
xx xx xx xx CRC-32 of the end header
... packed streams (page data)
... end header: file names, sizes, folders, codecs
The container details (codecs, filters, encryption) are on the 7z format page.
Solid blocks and page access#
7-Zip creates solid archives by default: many files are compressed together in one “folder” (solid block). To read one file, a decoder starts at the beginning of its block and decompresses everything before it. For a 300-page comic in one solid block, showing the last page means decompressing all 300 pages.
| Archive | Read page N | Typical use |
|---|---|---|
solid (default 7z a) |
decompress pages 1..N of the block | smallest archive |
non-solid (-ms=off) |
decompress page N only | comic readers, servers |
Readers handle solid CB7 by decompressing the whole archive once into memory or a temporary folder. Libraries with a streaming API (iterate entries in order) read solid archives efficiently; random access by name is slow.
Creating a CB7#
# non-solid, store only (pages are already compressed): fast page access
7z a -t7z -ms=off -mx=0 "Akira v01.cb7" "./Akira v01/*"
# non-solid with LZMA2, for uncompressed pages
7z a -t7z -ms=off -mx=9 "Akira v01.cb7" "./Akira v01/*"
Zero-pad page numbers (0001.png) so readers without natural sort keep the order.
Converting#
- CB7 to CBZ: extract and zip; nothing is re-encoded.
7z x -opages book.cb7 && 7z a -tzip -mx=0 book.cbz ./pages/*, orcomicbox -z book.cb7. - CBZ to CB7:
7z xthen7z a -t7z. Rarely worth it. - CB7 to EPUB/PDF: Calibre converts comic archives to EPUB, MOBI and PDF.
Specifications and documentation#
- 7z format (7-Zip): overview;
DOC/7zFormat.txtin the LZMA SDK describes the structure - ComicInfo.xml documentation (Anansi Project): the metadata schema
- Comic book archive on Wikipedia
Software that opens CB7 files#
| Software | Windows | macOS | Linux | Web | Can | Notes |
|---|---|---|---|---|---|---|
| SumatraPDF | ✓ | view | free, open source; reads ComicInfo.xml, manga (right-to-left) mode | |||
| CDisplayEx | ✓ | view | free comic reader | |||
| YACReader | ✓ | ✓ | ✓ | view | free, open source (GPL-3.0) | |
| MComix | ✓ | ✓ | view | free, open source | ||
| Kavita | ✓ | ✓ | ✓ | ✓ | view | free, open source reading server |
| Calibre | ✓ | ✓ | ✓ | view, convert | free, open source; converts CB7 to EPUB, PDF | |
| ComicTagger | ✓ | ✓ | ✓ | convert | free, open source; converts to CBZ to tag | |
| 7-Zip | ✓ | ✓ | create, convert | free, open source; creates and extracts 7z | ||
| PeaZip | ✓ | ✓ | ✓ | create, convert | free, open source archiver |
Libraries#
Open-source libraries that read (and some that write) CB7 files, with comic-specific examples (page order, cover, ComicInfo.xml). See all CB7 libraries; general 7z information is on the 7z page.
| C/C++ | libarchive |
|---|---|
| C# | SharpCompress |
| Java | Commons Compress |
| Go | archives, sevenzip |
| Python | comicbox, py7zr |
| Ruby | ffi-libarchive |
| Rust | compress-tools, sevenz-rust2 |