#[non_exhaustive]pub enum Op {
Show 40 variants
Resize {
width: u32,
height: u32,
mode: ResizeMode,
},
Thumbnail {
width: u32,
height: u32,
mode: ResizeMode,
},
Define {
key: String,
value: Option<String>,
},
Blur {
radius: u32,
sigma: f32,
},
Edge {
radius: u32,
},
Colors {
count: u32,
dither: Dither,
},
Format(String),
Quality(u32),
Strip,
Depth(u8),
EncoderOpt {
key: String,
value: String,
},
Threads(usize),
Density(u32),
Background([u8; 4]),
Alpha(AlphaOp),
Rotate {
degrees: i32,
},
Flip,
Flop,
Crop {
x: u32,
y: u32,
w: u32,
h: u32,
},
Negate,
Sharpen {
radius: u32,
sigma: f32,
},
Unsharp {
radius: u32,
sigma: f32,
amount: f32,
threshold: u8,
},
Gamma {
value: f32,
},
BrightnessContrast {
brightness: f32,
contrast: f32,
},
Contrast {
delta: i32,
},
Sepia {
threshold: f32,
},
Modulate {
brightness: f32,
saturation: f32,
hue: f32,
},
Level {
black: u8,
gamma: f32,
white: u8,
},
Normalize,
Threshold {
value: u8,
},
Posterize {
levels: u32,
},
Solarize {
value: u8,
},
Colorspace(String),
Vignette {
radius: f32,
sigma: f32,
x: f32,
y: f32,
},
Colorize {
color: [u8; 4],
amount: f32,
},
Equalize,
AutoGamma,
Extent {
width: u32,
height: u32,
x: i32,
y: i32,
bg: [u8; 4],
},
Trim {
fuzz: u8,
},
Roll {
dx: i32,
dy: i32,
},
}Expand description
One convert operation.
Operations apply in source order — same as imagemagick convert,
even though we don’t yet support IM’s stack-reset semantics.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Resize
-resize WxH[!^<>%@]. The trailing modifier selects the
scaling policy via ResizeMode; absence of any modifier is
ResizeMode::Default (aspect-preserving fit-inside).
Thumbnail
-thumbnail WxH[!^<>%@] — IM convenience flag. Same geometry
grammar as -resize; the runner unrolls it into a Resize plus
Strip pair (and, eventually, an auto-orient pass) so the
downstream pipeline doesn’t need a dedicated thumbnail node.
Define
-define KEY[=VALUE] — opaque codec-specific tunable forwarded
to the sink. Keys keep their literal form (e.g.
jpeg:dct-method); the sink encoder picks up keys it
recognises and silently ignores the rest, mirroring IM’s
“tolerant of irrelevant options” posture. Bare -define KEY
(no =VALUE) sets the key to JSON true.
Blur
-blur RxS. Sigma defaults to radius / 2.0 when the xS
portion is omitted (matches IM’s convention).
Edge
-edge R. Radius ignored by the current Sobel impl but parsed
for forward-compatibility.
Colors
-colors N paired with an optional -dither preceding it.
When present, the output is paletted via
oxideav_pixfmt before encoding.
Format(String)
-format FMT — override the container/codec decision
otherwise derived from the output extension.
Quality(u32)
-quality N — forwarded to the sink codec (e.g. JPEG quality,
WebP quality). Silently dropped by codecs that don’t honour it.
Strip
-strip — request that metadata (EXIF, XMP, ID3, etc.) be
dropped on write.
Depth(u8)
-depth N — output bit depth per channel for still-image
sinks (8 or 16). Caps the encoder input layout the planner
picks (a 10-bit HEIC → -depth 8 → 8-bit PNG) or asks for the
deeper layout (-depth 16). Without it the source’s own depth
is kept when the encoder can carry it.
EncoderOpt
--opt KEY=VALUE — an encoder option for still-image sinks,
validated against the target encoder’s declared options schema
(the keys oxideav info <codec> lists) and handed to the
encoder convert builds for the output. Repeatable; a later
value for the same key wins.
Threads(usize)
-threads N — thread budget for the pipeline route (the job’s
threads key: codec-internal fan-out and the frame-tap
encoder). 0 means auto (the host’s parallelism, the default).
Density(u32)
-density N — DPI for vector→raster conversion. PDF / SVG
pages are measured in PostScript points (1/72 inch); a page at
300 DPI rasterises to points × (300 / 72) pixels per axis.
Ignored on raster-only inputs.
Background([u8; 4])
-background COLOR — canvas fill colour used by the
rasteriser and by -alpha remove. CSS L3 named colours and
#hex 3/4/6/8 forms accepted (same parser as xc:).
Alpha(AlphaOp)
-alpha SUBCOMMAND — see AlphaOp.
Rotate
-rotate N — rotate by N degrees. Round-1 supports only
multiples of 90 (90/180/270 and the negatives). Other angles
are rejected by the args parser with a “only multiples of 90
supported” message.
Flip
-flip — vertical flip (reverse row order).
Flop
-flop — horizontal flip (reverse column order within each row).
Crop
-crop WxH+X+Y — extract a WxH bounding box at offset (X,Y).
The args parser accepts the IM grammar; runtime checks that the
bbox fits inside the input dimensions and errors cleanly when
it doesn’t.
Negate
-negate — per-pixel out = 255 - in on the colour channels;
alpha (when present) is unchanged.
Sharpen
-sharpen RxS — unsharp-mask sharpening with radius / sigma
(amount defaults to 1.0 in the factory). Sigma defaults to
radius / 2.0 when only R is given.
Unsharp
-unsharp RxS+amount+threshold — full unsharp-mask grammar.
Amount and threshold each default to a sensible value when
omitted (amount = 1.0, threshold = 0).
Gamma
-gamma G — power-law gamma correction. G > 0.
BrightnessContrast
-brightness-contrast B[,C] — brightness in [-100..=100],
contrast in [-100..=100] (both percent-of-range). Either
argument may be omitted; the IM grammar tolerates B,
Bx, BxC, B,C.
Contrast
-contrast (no value) — IM applies a tiny per-channel contrast
step. Multiple -contrast flags accumulate; we collapse them
into a single delta carried on the op (positive for -contrast,
negative for +contrast, which IM uses for the inverse). The
factory wires this to BrightnessContrast::new(0, 5*delta) —
a 5-percent step matching IM’s “single contrast bump” feel.
Sepia
-sepia THRESHOLD% — warm-tint mapping. threshold is a
scalar in 0.0..=1.0 (IM expresses it as a percentage of the
dynamic range; we accept either form on parse).
Modulate
-modulate B,S,H — IM’s HSL-style triplet. Each component is
percent-of-base around 100 (so 100,100,0 is identity, 200
doubles, 0 zeros, etc.). The hue field is “hue offset
percent” but image-filter takes degrees; we translate.
Level
-level B/G/W — input black point, gamma, white point. Black
and white are 0..=255; gamma must be > 0.
Normalize
-normalize — stretch the histogram to fill 0..=255.
Threshold
-threshold N% — binarise: pixels below value map to 0,
pixels at or above map to 255.
Posterize
-posterize N — collapse to N levels per channel.
Solarize
-solarize N% — invert pixels above the threshold.
Colorspace(String)
-colorspace gray|grey|rgb|srgb — round-1 covers only the
grayscale conversion (everything else is treated as a
pass-through, keeping the input colourspace).
Vignette
-vignette R+S+X+Y — Gaussian radial darkening centred at
(x, y). radius/sigma are in pixels (sigma defaults to
radius / 2.0 when omitted, matching IM); x/y are
normalised image-relative offsets in [0.0, 1.0] (the
image-filter factory takes them this way to stay
resolution-independent), defaulting to 0.5 / 0.5 (image
centre) when omitted.
Colorize
-colorize C[xC[xC]]/A% — linear blend toward a target colour
by amount. color is [R, G, B, A] (alpha defaults to
255); amount is a unit scalar in [0.0, 1.0] (IM expresses
it as a percentage of the dynamic range).
Equalize
-equalize (no value) — per-channel histogram equalisation via
CDF mapping.
AutoGamma
-auto-gamma (no value) — auto-gamma: pick a per-channel gamma
so the geometric mean lands at 0.5.
Extent
-extent WxH[+X+Y] — re-window the input onto a fixed WxH
canvas. The source is placed at signed offset (x, y) (default
(0, 0), IM’s top-left convention); pixels outside the source
rectangle are painted with bg (RGBA). Offsets may be negative
(-extent 100x100-10-10) to translate the source toward the
upper-left so its right / bottom edge can land inside the
window. Unlike Crop (only shrinks) and Resize (only scales),
Extent can both add canvas and discard content depending on
the requested geometry.
bg is captured at args-parse time from the most recent
-background op seen in source order (defaulting to IM’s
opaque white [255, 255, 255, 255] when none was set). Pinning
the colour onto the op preserves source-order semantics — a
later -background does NOT retroactively repaint an earlier
-extent’s padding.
Trim
-trim — auto-crop to the bounding box of pixels that differ
from a reference background colour by more than fuzz per
channel. The reference colour is the input’s (0, 0) pixel
(matching IM’s behaviour when no -bordercolor/-background
override is set). fuzz defaults to 0 (exact match); a
preceding -fuzz N[%] flag updates the value carried on this
op at args-parse time, so source order is preserved (-fuzz 10 -trim -fuzz 0 -trim lands as Trim { fuzz: 10 }, Trim { fuzz: 0 }).
Roll
-roll ±X±Y — circular pixel shift. dx shifts columns
to the right by dx pixels (negative = left); dy shifts
rows down by dy pixels (negative = up). Pixels that fall
off one edge wrap around to the opposite edge — width and
height stay unchanged, and the total pixel count is
preserved. The IM grammar requires both X and Y signed
(-roll +5+10, -roll -3+2); a single offset (-roll +5)
is rejected at parse time.