Skip to main content

Supported formats

filerepack identifies files by extension (including compound names such as archive.tar.gz). Nested members inside archives are walked with the same rules. Missing optional tools or Python extras leave the file unchanged.

JPEG, PNG, and PDF default to lossless tools. Use --lossy, --jpeg-quality, --png-quality, or --pdf-profile for lossy codecs. Output that is not smaller than the original is discarded unless --allow-grow.

CLI: CLI reference. Tools: External tools. Library: Python API.

Nested walking​

With --deep (default), archives are extracted, each inner file is packed, then the container is rewritten:

  1. ZIP family (OOXML, ODF, EPUB, JAR, APK, …) — extract, pack members, rewrite as ZIP. OOXML-like files prefer Info-ZIP zip when it is on PATH so extra 7-Zip fields do not break Word/Excel.
  2. 7z / RAR / CAB / WIM — same walk; RAR is rewritten as 7z when rar is missing.
  3. Tarballs (tar, tar.gz / tgz, tar.bz2, tar.xz, tar.zst, tar.br, tar.lz4, tar.lzo, tar.lz, tar.lzma, plus gem / crate / unitypackage) — unpack, pack members, rewrite the tarball. A compressed stream whose payload is a tar (.gz, .zst, …) is detected by peeking the first 512 decompressed bytes.
  4. Nested XML / JSON inside those containers is minified (see Markup).
  5. --no-archives skips nested archive rewriting. --no-images skips image, video, and audio packers (including cover art), not XML/JSON or PDF.

--include-ext tar.gz matches foo.tar.gz. --include-ext gz matches it too. --include-ext jpg matches .jpg, .jpeg, .jpe, .jfif, .jif, .jfi, and .thm.

Nested assets (not ZIP)​

These run on the host file even when it is not an archive:

HostExtra / toolWhat is packed
MP3, FLAC, M4A/M4B/MP4, Ogg, APEfilerepack[media] (mutagen)Attached cover pictures, then the usual codec packer
XML / SVGnonedata:image/…;base64 URIs decoded, packed, written back compact
PDF (lossless)filerepack[pdf] (pikepdf)Embedded JPEG / JPEG 2000 / Flate image streams, then qpdf

If the extra is missing, or nothing shrinks, the host is left unchanged (codec-only packers may still run). Encrypted or digitally signed PDFs skip stream replacement; lossless qpdf may still run. --lossy / --pdf-profile / --jpeg-quality skip pikepdf and use Ghostscript instead.

Office and ZIP-family archives​

Needs 7zz or 7z. OOXML also benefits from zip.

GroupExtensions
Microsoft OOXMLdocx, docm, dotx, dotm, xlsx, xlsm, xltx, xltm, xlsb, xlam, pptx, pptm, ppsx, ppsm, potx, potm, ppam, sldx, sldm, thmx, vsdx, vsdm, vstx, vstm, vssx, vssm, accdt, crtx, gcsx, glox, gqsx, vdw, zipx, xps, oxps, dwfx
OpenDocument / OpenOfficeodt, ods, odp, odg, odf, odb, odc, odi, odm, ott, ots, otp, otg, oth, otm, otc, oti, sxw, sxc, sxi, sxd, sxg, sxm, stw, stc, sti, std
Apple iWorkpages, key, numbers, kth, nmbtemplate, template
E-books / packagesepub, lpf, ibooks, oxt
App / language packagesjar, egg, whl, war, ear, aar, apk, aab, xapk, apks, ipa, appx, msix, appxbundle, nupkg, snupkg, vsix, xpi, crx, npz
Design / comics / other ZIPzip, xmind, idml, sketch, kra, ora, xd, afpub, afphoto, afdesign, scrivx, cbz, kmz, 3mf, usdz, ifczip, fcstd, mxl, rtb, onepkg, wgt, air, pk3, xap, ipsw, osk, oex, puz, rmskin, notebook, nbk, mcworld, mcpack, mcaddon

.otf is packed as ODF only when the file is a ZIP (OpenType fonts are skipped).

Other archive families:

FamilyExtensionsNotes
7z7z, cb7
RARrar, cbrRewritten as .7z if rar is missing
CAB / WIMcab, wim7-Zip writable containers
Tartar, cbt, tgz, taz, tbz, tbz2, txz, tzst, tlz, tzo, gem, crate, unitypackageInner files packed, then the tarball rewritten

Markup (XML, JSON, SVG)​

KindExtensionsBehaviour
JSONjsonCompact UTF-8 (separators=(',', ':')). Invalid JSON is skipped
XMLxml, xhtml, kml, gpx, dae, rss, atom, xmp, xsl, xslt, fb2Minify ignorable whitespace; text nodes unchanged; xml:space="preserve" kept. Unparseable XML is skipped
SVGsvgsvgo or scour first; XML minify if both are missing. data: images are packed
SVGZsvgzDecompress, pack as SVG, recompress

These are document packers: --no-images does not skip them. Nested word/*.xml inside a .docx is minified during the ZIP walk.

Images​

--no-images skips this category. Lossless JPEG/PNG strip EXIF/ICC unless --keep-meta.

KindExtensionsTools
JPEGjpg, jpeg, jpe, jfif, jif, jfi, thmLossless: jpegtran then jpegoptim. Lossy: jpegoptim -m (--jpeg-quality / --lossy)
PNG / APNGpng, apngoxipng / optipng; --ultra also tries zopflipng. Lossy: pngquant
GIFgifgifsicle
WebPwebpdwebp + cwebp
TIFFtif, tiffImageMagick or tiffcp
AVIFavifavifenc/avifdec (ImageMagick fallback). --lossy selects a lossy encode
HEICheic, heifImageMagick. --lossy selects a lossy encode
JPEG XLjxlcjxl + djxl
JPEG 2000jp2, j2k, jpf, jpxImageMagick
OpenEXR / DNGexr, dngImageMagick; DNG also tiffcp
ICO / CUR / ICNSico, cur, icnsImageMagick
BMP / TGA / PNM / PCXbmp, dib, tga, targa, pnm, ppm, pgm, pbm, pcx, dcxImageMagick lossless
PhotoshoppsdRecompress ZIP-encoded layer/composite channels (RLE/raw left unchanged)
DICOMdcm, dicom, dicLossless JPEG-LS via gdcmconv or dcmcjpls. Signed, non-image, and already-compressed instances are skipped. --lossy does not apply

Documents (PDF)​

KindExtensionsLosslessLossy
PDFpdfpikepdf stream walk (filerepack[pdf]) then qpdf. Without pikepdf: qpdf onlyGhostscript --lossy (/ebook unless --pdf-profile) or --pdf-profile. --jpeg-quality sets Distiller QFactor
IllustratoraiSame as PDF when the file is a PDF wrapperSame Ghostscript path

Video and audio​

--no-images skips these. WMV/AVI/ASF/3GP/MPEG-TS convert to MP4 unless --no-convert-container. MKV/WebM/MOV/M4V keep their container.

KindExtensionsTools
Videomp4, mkv, webm, mov, m4v, wmv, avi, asf, 3gp, ts, mts, m2tsffmpeg. --wmv-lossless is CRF 0 (VP9 lossless for WebM)
FLACflacflac recompress; covers with filerepack[media]
ALAC / M4Am4a, m4bffmpeg ALAC when applicable; covers with mutagen
Ogg / Opusogg, opus; ogaoptivorbis for Vorbis/Opus. FLAC-in-Ogg .oga stays on ffmpeg
WavPack / TTAwv, ttaffmpeg
Monkey's Audioapemac when installed; covers with mutagen
MP3mp3mp3packer (lossless frame packing). --ultra passes -z. Covers with mutagen

optivorbis and mp3packer are not in Homebrew/apt; see External tools.

Compressed streams and data​

KindExtensionsTools / extra
gzip / xz / bzip2 / zstd / brotligz, xz, bz2, zst, brpigz/gzip, xz, bzip2, zstd, brotli
lz4 / lzip / lzma / lzo / compresslz4, lz, lzma, lzo, zlz4, lzip, lzma, lzop, compress
SQLitesqlite, sqlite3, db, gpkg, mbtilesVACUUM. .db still requires the SQLite format 3 header
Parquetparquetfilerepack[parquet] or [data] (DuckDB). --ultra is zstd level 22
ORC / Avro / Feather / Arroworc, avro, feather, arrow, ipcfilerepack[data]
HDF5 / NetCDFh5, hdf5, hdf, nc, nc4h5repack, nccopy
WOFF / WOFF2woff, woff2filerepack[fonts] (fonttools) or woff2_compress / woff2_decompress

Not supported​

These stay untouched (no extract + rewrite):

  • Signed installers: deb, rpm, pkg, dmg
  • Disc/library archives 7-Zip cannot create: iso, cpio, ar / a / lib
  • OpenType .otf fonts (ZIP ODF templates with that extension are packed)

Python extras​

pip install 'filerepack[parquet]' # DuckDB Parquet
pip install 'filerepack[data]' # Parquet + ORC/Avro/Feather/Arrow
pip install 'filerepack[fonts]' # WOFF/WOFF2 via fonttools
pip install 'filerepack[progress]' # rich progress bars
pip install 'filerepack[media]' # mutagen cover-art walking
pip install 'filerepack[pdf]' # pikepdf lossless PDF streams