Skip to content

Using pja

YadeWira edited this page Nov 7, 2026 · 3 revisions

Using pja

pja a [options] FILE...     compress:  photo.jpg -> photo.pja, scan.jls -> scan.pja, map.jp2 -> map.pja
pja x [options] FILE...     extract:   photo.pja -> photo.jpg (the original's extension)
pja list FILE...            what each .pja holds: original size, stored size, hash
pja t FILE...               test each .pja: extract and verify in memory, write nothing
pja info FILE...            the structure of each file, and what PJA does with it
pja report [FILE]           a bug report (no pixels, no metadata) and a link to open an issue
pja bench FILE...           how fast this machine runs a and x on them
pja selftest                the samples inside the binary, on every SIMD path here
pja --version               the build, the compilers, the system and the SIMD path

Examples

pja a photo.jpg                     # photo.pja next to it
pja a *.jpg --output-dir=packed     # many files into a folder
pja x packed/*.pja -o restored/     # back, into another folder
pja list packed/*.pja               # sizes and hashes, without extracting
pja t packed/*.pja                  # check them without writing anything
pja a -th 2 photos/*.jpg            # at most two threads
pja info scan.jp2                   # what is inside, and what PJA does with it
pja a --json *.jpg > out.jsonl      # one JSON object a file, then a summary

On Windows pja expands * and ? itself (neither cmd nor PowerShell does it for a program): pja a photos\*.jpg works there too.

Switches

switch what it does
-o PATH output name with one input; a directory if it exists or ends in /
--output-dir=DIR output directory
-f, --force replace an existing output (only with something that verified)
-th N, --threads=N threads; by default the processors, up to 8
--fast a: accepted for older scripts; changes nothing since 0.1.0
--no-verify a: skip decompressing the stream before writing (about twice as fast)
--max-output=SIZE x: refuse an original declared above SIZE (256M by default; 0 = no limit)
--keep-corrupt x: keep an output that does not verify as NAME.corrupt
-n, --dry-run do everything but write
--no-sync a, x: do not wait for each output to reach the disk before it takes its name (faster; a power cut may then leave an output empty or missing)
--clean-temps a, x: delete the temporaries an interrupted run left (only PJA's, older than an hour, whose process is gone)
-q, --quiet only errors
--stats a, x, t: where each file's time went, its threads and bands, and a line for the run
--json a, x, t, info, list: one JSON object a line for each file, then a summary
--cpu=PATH the SIMD path: plain, sse41 or avx2 (every one writes the same bytes)
-- everything after it is a file, even if it starts with a dash

Values go with = or a space: -th 4 or --threads=4, never -th4.

What to expect

  • An existing output is never replaced without -f.
  • With several inputs, -o must be a directory, so files cannot overwrite each other.
  • The original's extension comes back as it was (photo.JPEG stays photo.JPEG, scan.jls stays scan.jls).
  • A .pja is never more than 52 bytes larger than its original: a file PJA cannot shrink is stored as it is, and a says so.
  • Files PJA cannot model as JPEG still go through, as bytes, and a says why (as bytes: ...); see What PJA handles.

Exit status: 0 when every file went through, 1 when any failed (each with its own line on stderr), 2 for a usage error, 3 for a bug in PJA (it says so, and how to report it: Reporting bugs), and 130, 143, 129 or 141 when Ctrl-C or a signal ended it (the files being written are deleted first).

The full manual, with the reasons behind each choice, is doc/CLI.md.

Clone this wiki locally