# HANDOFF.md Current state of the comic compression toolchain as of 2026-06-28. ## Repositories | Repo | Branch | Latest commit | |------|--------|---------------| | `comic-compress-new` (CLI) | main | `94f3fab` | | `iMGcompress-core` (library) | master | `a03d0e5` | | `iMGcompress` (GUI) | master | `7b7021a` | ## What was done in this session (v3.1.0 / v2.0.0) ### NuGet package updates (all three projects) - SharpCompress `0.42` → `0.49.1` (CVE GHSA-6c8g-7p36-r338 fixed) - Magick.NET-Q8-x64 → `14.14.0` (multiple CVEs fixed) - Imazen.WebP → `11.0.0` - Imageflow.AllPlatforms + Imageflow.Net → `0.15.1` - iTextSharp → `5.5.13.5`, itext → `9.6.0` - McMaster.Extensions.CommandLineUtils → `5.1.0` - System.Drawing.Common → `10.0.9` ### SharpCompress 0.49 breaking API migration (`iMGcompress-core`) - `ReaderFactory.Open` → `OpenReader(stream, new ReaderOptions())` - `RarArchive/ZipArchive.Open` → `OpenArchive(filename, new ReaderOptions())` - `ZipArchive.Create()` → `CreateArchive()` - `SaveTo(path, CompressionType)` → `SaveTo(path, new ZipWriterOptions(CompressionType))` - Return type `ZipArchive` → `IWritableArchive` - Removed `using ZstdSharp` (internalized in 0.49) ### Parallel within-archive compression (`iMGcompress-core`, `-P` flag) - New `ProcessArchivePAR2` + `CompressEntrySync` in `Compressor.cs` - Batched 3-phase design: sequential read → `Parallel.For` (`ProcessorCount/2` threads) → sequential write - Ordering guaranteed by indexed pre-allocated result slots - Measured speedup: **~3.4–5×** vs serial on i7-12700KF (10 batch size) - Memory bounded per batch; logs strictly in original entry order from write phase ### MemoryStream pre-sizing (`iMGcompress-core`) - All `new MemoryStream()` → `new MemoryStream(entry.Size > 0 ? (int)entry.Size : 4096)` - Eliminates buffer-doubling reallocations on all 9 allocation sites in `Compressor.cs` ### CLI fixes and new flags (`ComicCompress`) - Fixed missing `OnExecuteAsync` — app was throwing `InvalidOperationException` on launch - Added `-w|--new-webp`: use Imageflow encoder (experimental; benchmarked 8–15% slower than Imazen.WebP) - Added `-P|--par-archive`: enable parallel within-archive compression ### GUI (`iMGcompress`) - Added `checkBox_parArchive` (flat-button, location `382,231`, TabIndex 14) - Default ON for COMIX and COMIX+PDF modes; OFF for IMAGE and ZEBRA - Wired into `FileProcessor.ProcessorFlags` constructor - Version bumped to `2.0.0 (28/06/2026)` ### Other - Added `CLAUDE.md` to `comic-compress-new` with build commands and architecture notes ## Current versions - CLI (`ComicCompress`): `3.1.0 (28/06/2026)` — see `Program.cs` - GUI (`iMGcompress`): `2.0.0 (28/06/2026)` — see `MGCompress.cs` ## Known state / open items - **Imageflow encoder** (`-w` flag) is wired and working but consistently slower than Imazen.WebP across all tested archive sizes. Kept as an experimental path only. - **`libwebp.dll`** must be present alongside the executable — it is checked into the repo root of both `comic-compress-new` and `iMGcompress-core`. - The GUI runs single-threaded on the UI thread (`button_start_Click` is synchronous). Long jobs block the window. Not addressed in this session.