How Digital Comic Archives Work: CBZ/CBR Formats, Scan Restoration, and Modern Web Readers
If you have ever unpacked a .cbz file by renaming it to .zip, you already know the open secret of digital comics. Comic archives are not proprietary binary formats at all. They are plain archive files holding numbered im
If you have ever unpacked a .cbz file by renaming it to .zip, you already know the open secret of digital comics. Comic archives are not proprietary binary formats at all. They are plain archive files holding numbered images, often paired with an XML file for metadata.
That simplicity is probably why the format survived more than twenty years. In the early 2000s, David Ayton popularized .cbr and .cbz through CDisplay, a lightweight sequential viewer for Windows. While specialized e-book formats came and went, a folder of images inside a standard ZIP archive proved hard to break.
Container formats: why CBZ beat CBR, CB7, and PDF
Every comic archive extension just tells the reader which container sits underneath. Four variants still show up in the wild, though only one makes sense for long-term storage today.
| Extension | Container | Random Access | Tooling |
|---|---|---|---|
.cbz |
ZIP (application/vnd.comicbook+zip) |
Fast (central directory) | Open, universal |
.cbr |
RAR (application/vnd.comicbook-rar) |
Slow on solid archives | Proprietary encoder |
.cb7 |
7-Zip (LZMA/LZMA2) | Slow on solid blocks | Open, heavy decode |
.cbt |
TAR (uncompressed) | Sequential scan only | Open, rare |
You might occasionally see .cba (ACE) in old dumps. Most security teams block ACE files now due to historic unace path-traversal bugs.
CBZ beats CBR and CB7 for one clear reason: random access. A ZIP file keeps a central directory at the end with exact byte offsets for every entry, so readers can jump straight to page 24 without unpacking pages 1 through 23. Solid RAR and 7-Zip archives compress files as one stream, forcing a viewer to decode earlier pages just to seek forward.
ZIP also avoids double-compression waste. Since JPEG, PNG, and WebP files are already compressed, packing a .cbz with -0 (store mode) finishes in milliseconds and speeds up page reads with almost no size penalty.
Archivists also avoid PDF for comics because it wraps raster art in a print-preflight document tree. Extracting pages from a PDF often triggers re-encoding or DPI scaling, while a .cbz returns the exact original image bytes.
Sorting quirks and ComicInfo.xml metadata
A bare archive of images has no native concept of series title, issue number, or reading order. Early collectors crammed those details into brittle filenames, which quickly broke once libraries grew past a few hundred issues.
Even page order fails when filenames lack zero-padding. Standard ASCII sorting puts 10.jpg right after 1.jpg, ahead of 2.jpg. Good archival scripts always pad names to fixed-width integers like 0001.webp and 0002.webp, keeping page order identical across desktop apps and web servers.
For structured tags, the community settled on ComicInfo.xml, first built for ComicRack and later maintained under the Anansi Project schema. The XML file sits at the root of the .cbz beside the page images.
<ComicInfo>
<Series>Midnight Signal</Series>
<Number>12</Number>
<Year>1986</Year>
<PageCount>24</PageCount>
<Pages>
<Page Image="0" Type="FrontCover" />
<Page Image="11" DoublePage="true" />
</Pages>
</ComicInfo>
That <Pages> block does more than list credits. Marking Type="FrontCover" or DoublePage="true" lets reading apps build accurate thumbnails, pair two-page spreads cleanly, and respect right-to-left manga layouts without guessing.
Restoring vintage scans: halftone screens and yellowed newsprint
Scanning a modern glossy hardcover is routine. Digitizing a 1968 newsprint issue without ruining the ink work is a harder engineering problem.
Vintage comics went to press on acidic wood-pulp paper using coarse CMYK halftone dots (Ben-Day dots in flat color zones). When a 600 DPI scan gets downsampled for a screen, the halftone grid clashes with the pixel grid. As a result, wavy interference called moirΓ© shows up across faces and skies.
Most archival pipelines clean raw newsprint scans in three steps.
- Descreening. A selective Gaussian blur or 2D Fast Fourier Transform (FFT) notch filter suppresses the repeating halftone grid while leaving sharp black ink lines intact.
- Newsprint color balance. Curves or Levels shift the white point to neutralize yellowed pulp while keeping slight paper warmth.
- Black-point cleanup. Faded charcoal inks move back toward deep black without crushing fine crosshatching in dark panels.
Over-processing is likely the most common mistake in amateur scans. Heavy denoising wipes out pencil grain and turns brushwork into flat plastic, so serious groups archive raw 600 DPI TIFF or lossless PNG masters offline and generate lighter reading copies separately.
Image codecs: JPEG and PNG vs. WebP and AVIF
Inside a comic archive, the codec controls both disk cost and how crisp lettering looks on HiDPI screens.
Older .cbz files mostly use JPEG. At quality 85 to 90, JPEG handles painted covers well, though 4:2:0 chroma subsampling tends to smear red and yellow ink across sharp speech-bubble text. Lossless PNG avoids artifacts, yet a 32-page issue at 2000px height climbs past 120 MB.
Modern pipelines usually transcode reading copies to WebP or AVIF.
- WebP (lossy quality 75 to 82 or near-lossless). Cuts file size by roughly 25 to 35 percent versus JPEG, keeps line art clean around lettering, and decodes fast on every browser.
- AVIF. Pushes file size even lower, often half the weight of JPEG on flat color fills, though software decoding on older mobile chips can feel sluggish during fast page flips.
In practice, WebP seems to hit the sweet spot for web readers right now. You save real bandwidth without making the browser stutter between panels.
How modern web readers stream pages without lag
Desktop apps like CDisplayEx, Sumatra PDF, or Calibre assume the whole .cbz sits on a local SSD. A browser has no such luck. Asking someone on mobile data to download an 85 MB archive before viewing page one is a guaranteed bounce.
Modern web archives solve this by unpacking .cbz containers server-side and serving individual resized WebP pages over a CDN. Platforms like BatCave show how well this works in practice: instead of making readers juggle local archive files and desktop viewers, the browser streams classic and modern issues directly, page by page, with responsive scaling.
Under the hood, a fast web reader relies on three browser tricks working together.
-
Viewport-driven lazy loading.
IntersectionObservermounts images only as the reader nears them, whiledecoding="async"keeps image decode work off the main scroll thread. -
Lookahead prefetching. The client quietly fetches pages
N+1andN+2into cache while you read pageN, so page turns feel instant. - Spread detection. Layout code checks pixel ratios before drawing a two-page view, so wide splash art never splits awkwardly across two screens.
function isDoublePageSpread(img, threshold = 1.2) {
return img.naturalWidth / img.naturalHeight > threshold;
}
Once the reader knows page 12 is a wide spread (from ComicInfo.xml or stored pixel dimensions), it switches to full-width single-slot layout automatically.
Putting the stack together
Building a comic archive or web reader from scratch is actually straightforward. Store raw masters in .cbz (ZIP store mode) with zero-padded filenames and a valid ComicInfo.xml at the root. For browser playback, transcode reading copies to WebP, record pixel dimensions upfront for spread checks, and prefetch two pages ahead.
Perhaps the best part is how little the core container had to change. A renamed ZIP file from 2000 still holds up, while clean metadata, halftone cleanup, modern codecs, and streaming readers keep seventy years of comic art sharp today.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.