You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
nicksxs fe11154954 add code 4 months ago
Sources/JXLOptim add code 4 months ago
.gitignore add code 4 months ago
Package.swift add code 4 months ago
README.md add code 4 months ago
bundle.sh add code 4 months ago

README.md

JXL Optim

An ImageOptim-style drag-and-drop optimizer that re-encodes JPG / PNG / GIF into JPEG XL (.jxl). Native SwiftUI, macOS 12+. Wraps the cjxl encoder from libjxl.

Prerequisites

brew install jpeg-xl   # provides cjxl / djxl

The app looks for cjxl in /usr/local/bin, /opt/homebrew/bin, /usr/bin. If it isn't found you'll see a red banner with the install hint.

Build & run

swift run            # dev: launches the window
./bundle.sh          # builds "JXL Optim.app" (release, double-clickable)
open "JXL Optim.app"

Use

Drop images onto the window. Each is converted to a sibling .jxl; the row shows before → after and the percentage saved. A running total sits at the bottom.

Controls:

  • Lossless — pixel-exact (cjxl -d 0). PNG/GIF stay perfect; JPEG is transcoded losslessly (decode-back gives the original).
  • Quality — visual distance d0.5–d3.0 (lower = better). d1 ≈ visually lossless.
  • Effort — encoder effort 1–9; higher is slower but smaller.
  • Keep original — off deletes the source after a successful encode.

How it maps to cjxl

cjxl in.png out.jxl -e <effort> --num_threads 0 [-d 0 | -d <distance>]

讲解文章在 Niamos vault: wiki/projects/自己写一个 JPEG XL 压缩器.md。