Skip to content

packPNG v1.8a — keep console open on help/error exits

Choose a tag to compare

@YadeWira YadeWira released this 05 May 14:52
· 9 commits to master since this release

v1.8a — bugfix: keep console window open on help and error exits

A small but annoying paper-cut reported on encode.su: running
packPNG.exe via double-click (or any context that creates a fresh
console — Windows shortcut, drag-and-drop, etc.) would close that console
window before the user could read the help text or error message.

Cause: only the two success-path branches of main() went through the
existing "Press to quit" wait. Every other return — help on
no-args, help on empty filelist, all argument-parsing errors, and the
"no PNG/JNG files to compress" exit — return-ed straight from main(),
so the console terminated immediately after.

Fix: extract a tiny wait_and_return(int code) helper that respects
wait_exit && !module_mode (the same predicate the existing two
success-path waits already used), and route every user-visible return
through it. -np and -module keep skipping the prompt for scripted /
machine invocations exactly as before.

What changed

  • 9 user-visible return paths in main() now flow through
    wait_and_return(...) so the console stays open for the user to read
    output, regardless of how packPNG.exe was launched.
  • Manifest assemblyIdentity@version bumped 1.8.0.01.8.0.1
    (revision tick for the bugfix-letter, per Win32 PE convention).

What didn't change

  • Wire format unchanged: .ppg files written by v1.8 decode under
    v1.8a and vice versa, both TCIP (PNG/APNG) and TCIJ (JNG) magics.
  • PNG / APNG / JNG paths: identical compression behaviour to v1.8.
  • CLI flags: -np and -module continue to bypass the wait
    exactly as before.

Verified on Linux

no-args path  → "Press <enter> to quit" shown    OK
-mZ error     → error + "Press <enter> to quit"  OK
-od no path   → error + "Press <enter> to quit"  OK
-np           → no prompt                         OK
-module       → no prompt                         OK
PNG / JNG round-trip → byte-exact                OK

Verified on Windows 11

A test-v1.8a.bat selftest harness ships alongside the Windows binary in
the release. It runs 14 tests covering every v1.7e regression check, the
4 new wait-path tests, and a JNG round-trip regression for the v1.8
feature. ASCII-only with CRLF so cmd.exe parses it correctly before
chcp 65001 applies. Just drop it next to the .exe and double-click.

Binaries

  • packPNG-linux-x86_64-v1.8a — Linux x86-64, dynamically linked
    (zlib, liblzma, libzstd, libdeflate, libkanzi, pthread).
  • packPNG-windows-x86_64-full-v1.8a.exe — Windows x86-64, statically
    linked, mingw-w64 cross-compiled, UTF-8 active-code-page manifest.

Side note: YCoCg-R prototype

Following a suggestion on encode.su, I prototyped YCoCg-R (lifting form,
mod-256, fully reversible) as an opt-in pre-BWT transform in this same
cycle. Result: +2.06% regression on a combined 42-file corpus
(PngSuite, synthetic gradients, real photos, wild PNGs). The kanzi
RLT+BWT+SRT+ZRLT/FPAQ pipeline already does enough byte-decorrelation
that adding YCoCg on top tends to disrupt rather than help. Reverted
before this release — the negative result is documented for future
re-experimentation if the pipeline architecture changes.

🤖 Generated with Claude Code