Skip to content

Formats Reference ​

Complete list of formats supported by Paraphase converters.

Serde Formats (paraphase-serde) ​

All serde formats use serde_json::Value as an intermediate representation, enabling conversion between any pair of enabled formats.

Text Formats ​

FormatFeatureExtensionsNotes
JSONjson.jsonDefault enabled
YAMLyaml.yaml, .ymlDefault enabled
TOMLtoml.tomlDefault enabled
RONron.ronRust Object Notation
JSON5json5.json5JSON with comments, trailing commas
Hjsonhjson.hjsonHuman JSON; comments + unquoted strings
KDLkdl.kdlKDL Document Language
HCLhcl.hcl, .tfHashiCorp Configuration Language
XMLxml.xmlVia quick-xml
TSVtsv.tsvTab-separated values
INIini.iniKey-value config
Java propertiesproperties.propertiesJava-style key=value
.envdotenv.envEnvironment variable files
S-expressionslexpr.lisp, .sexpLisp-style
URL-encodedurlencoded-Form data
Query stringsqs-Nested query params

Planned: amazon-ion + paraphase-ion ​

Amazon Ion (JSON superset from AWS) — standalone amazon-ion crate (useful beyond Paraphase), roll our own from the public spec. Binary + text, ~3,500 LOC, well-specified. Not waiting for ion-rs (unstable API, ~1yr of unreleased commits). paraphase-ion wraps amazon-ion into the converter registry. Rescribe depends on amazon-ion for KFX support.

Binary Formats ​

FormatFeatureExtensionsNotes
MessagePackmsgpack.msgpack, .mpCompact binary JSON-like
CBORcbor.cborConcise Binary Object Representation
Bincodebincode.bincode, .bcRust-native binary
Postcardpostcard.postcard, .pcEmbedded-friendly
BSONbson.bsonMongoDB binary format
FlexBuffersflexbuffers.flexbufSchema-less FlatBuffers
Bencodebencode.bencode, .torrentBitTorrent format
Picklepickle.pickle, .pklPython serialization
Property Listplist.plistApple binary plist

Feature Groups ​

toml
# Cargo.toml for paraphase-serde
[features]
default = ["json", "yaml", "toml"]
all = ["json", "yaml", "toml", "ron", "json5", "hjson", "kdl", "hcl",
       "xml", "tsv", "ini", "properties", "dotenv", "lexpr",
       "urlencoded", "qs", "msgpack", "cbor", "bincode", "postcard",
       "bson", "flexbuffers", "bencode", "pickle", "plist"]

Image Formats (paraphase-image) ​

All image formats use image::DynamicImage as an intermediate representation.

Lossless Formats ​

FormatFeatureExtensionsNotes
PNGpng.pngDefault enabled
GIFgif.gifDefault enabled, animated support
BMPbmp.bmpWindows bitmap
ICOico.icoWindows icon
TIFFtiff.tif, .tiffTagged image
TGAtga.tgaTruevision
PNMpnm.pnm, .pbm, .pgm, .ppm, .pamPortable anymap family
Farbfeldfarbfeld.ffSimple lossless
QOIqoi.qoiQuite OK Image

Lossy Formats ​

FormatFeatureExtensionsNotes
JPEGjpeg.jpg, .jpegDefault enabled
WebPwebp.webpDefault enabled
AVIFavif.avifAV1-based

HDR Formats ​

FormatFeatureExtensionsNotes
OpenEXRopenexr.exrHigh dynamic range
Radiance HDRhdr.hdrRGBE format

Feature Groups ​

toml
# Cargo.toml for paraphase-image
[features]
default = ["png", "jpeg", "webp", "gif"]
all = ["png", "jpeg", "webp", "gif", "bmp", "ico", "tiff", "tga",
       "pnm", "farbfeld", "qoi", "avif", "openexr", "hdr"]

Image Transforms ​

Beyond format conversion, paraphase-image provides transform operations:

ConverterDescriptionOptions
image.resizeResize imagemax_width, max_height, scale, target_width, target_height
image.crop-aspectCrop to aspect ratioaspect (e.g., "16:9"), gravity
image.watermarkOverlay watermarkposition, opacity, margin (multi-input)

Resize options:

  • max_width / max_height: Fit within bounds, preserving aspect ratio (no upscaling)
  • scale: Scale factor (e.g., 0.5 for half size)
  • target_width / target_height: Exact dimensions (may change aspect ratio)

Gravity presets (for crop anchor point):

PresetAliases
top-leftnw, northwest
topn, north
top-rightne, northeast
leftw, west
centerc, middle (default)
righte, east
bottom-leftsw, southwest
bottoms, south
bottom-rightse, southeast

CLI usage:

bash
# Resize to fit within 1024px width
paraphase convert photo.png photo.webp --max-width 1024

# Scale to 50%
paraphase convert photo.png thumb.png --scale 0.5

# Crop to 16:9, keeping top of image
paraphase convert photo.png banner.png --aspect 16:9 --gravity top

# Combine: crop to square, resize, convert format
paraphase convert photo.png avatar.webp --aspect 1:1 --max-width 200

# Add watermark
paraphase convert photo.png branded.png --watermark logo.png

# Watermark with options
paraphase convert photo.png branded.png --watermark logo.png \
  --watermark-position bottom-right --watermark-opacity 0.5 --watermark-margin 20

Watermark options:

  • position: Where to place the watermark (uses gravity presets above)
  • opacity: Watermark transparency (0.0-1.0, default 1.0)
  • margin: Pixels from edge (default 0)

CSV / XLSX (paraphase-serde) ​

CSV and XLSX write are handled by paraphase-serde with dedicated features.

ConverterIDFeatureDescription
CSV → JSONserde.csv-to-jsoncsvParse CSV to JSON array of objects (first row = headers)
JSON → CSVserde.json-to-csvcsvSerialize JSON array of flat objects to CSV
JSON → XLSXserde.json-to-xlsxxlsxwriteWrite JSON array of objects to XLSX spreadsheet
bash
paraphase convert data.csv data.json
paraphase convert data.json out.csv
paraphase convert data.json out.xlsx

Vector Graphics (paraphase-vector) ​

SVG rasterization via resvg/tiny-skia.

ConverterIDFeatureDescription
SVG → PNGvector.svg-to-pngsvgRender SVG to PNG
SVG → JPEGvector.svg-to-jpegsvgRender SVG to JPEG
SVG → WebPvector.svg-to-webpsvgRender SVG to WebP

Input properties: optional width, height to override render resolution.

bash
paraphase convert logo.svg logo.png
paraphase convert diagram.svg diagram.jpg

Font Formats (paraphase-font) ​

TTF/OTF ↔ WOFF1 conversion in pure Rust using flate2.

ConverterIDFeatureDescription
TTF → WOFFfont.ttf-to-woffwoffWrap TTF in WOFF1 container
OTF → WOFFfont.otf-to-woffwoffWrap OTF in WOFF1 container
WOFF → TTFfont.woff-to-ttfwoffExtract TTF from WOFF1 container
bash
paraphase convert font.ttf font.woff
paraphase convert font.otf font.woff
paraphase convert font.woff font.ttf

Geospatial Formats (paraphase-geo) ​

GPX ↔ GeoJSON via the gpx crate.

ConverterIDFeatureDescription
GPX → GeoJSONgeo.gpx-to-geojsongpxConvert GPX tracks/waypoints to GeoJSON FeatureCollection
GeoJSON → GPXgeo.geojson-to-gpxgpxConvert GeoJSON to GPX
bash
paraphase convert tracks.gpx tracks.geojson
paraphase convert route.geojson route.gpx

PKI / Certificate Formats (paraphase-pki) ​

PEM ↔ DER via pem-rfc7468.

ConverterIDFeatureDescription
PEM → DERpki.pem-to-derpemDecode PEM to raw DER bytes
DER → PEMpki.der-to-pempemEncode DER bytes as PEM

Properties: pem_label — the PEM label string (e.g., "CERTIFICATE", "PRIVATE KEY"). Preserved on decode, required on encode (default: "CERTIFICATE").

bash
paraphase convert cert.pem cert.der
paraphase convert cert.der cert.pem

Subtitle Formats (paraphase-subtitle) ​

Pure Rust SRT/VTT/SBV conversion — no external dependencies.

ConverterIDFeatureDescription
SRT → VTTsubtitle.srt-to-vttsrt + vttSubRip to WebVTT
VTT → SRTsubtitle.vtt-to-srtsrt + vttWebVTT to SubRip
SRT → SBVsubtitle.srt-to-sbvsrt + sbvSubRip to SubViewer
SBV → SRTsubtitle.sbv-to-srtsrt + sbvSubViewer to SubRip
VTT → SBVsubtitle.vtt-to-sbvvtt + sbvWebVTT to SubViewer
SBV → VTTsubtitle.sbv-to-vttvtt + sbvSubViewer to WebVTT
bash
paraphase convert subtitles.srt subtitles.vtt
paraphase convert subtitles.vtt subtitles.srt
paraphase convert subtitles.sbv subtitles.vtt

Color Palette Formats (paraphase-color) ​

Pure Rust GPL/ACO/ASE ↔ JSON conversion — no external dependencies.

ConverterIDFeatureDescription
GPL → JSONcolor.gpl-to-jsongplParse GIMP Palette to JSON
JSON → GPLcolor.json-to-gplgplSerialize JSON palette to GIMP Palette
ACO → JSONcolor.aco-to-jsonacoParse Photoshop Color Swatches to JSON
JSON → ACOcolor.json-to-acoacoSerialize JSON palette to ACO
ASE → JSONcolor.ase-to-jsonaseParse Adobe Swatch Exchange to JSON
JSON → ASEcolor.json-to-aseaseSerialize JSON palette to ASE

JSON palette format:

json
{
  "name": "My Palette",
  "colors": [
    { "r": 255, "g": 0, "b": 0, "name": "Red" },
    { "r": 0, "g": 128, "b": 0, "name": "Green" }
  ]
}
bash
paraphase convert palette.gpl palette.json
paraphase convert palette.json palette.gpl
paraphase convert swatches.aco swatches.json
paraphase convert palette.json palette.ase

Audio Formats (paraphase-audio) ​

Pure Rust audio processing via Symphonia (decode) and Hound (WAV encode).

Supported Formats ​

FormatDecodeEncodeFeature
WAV✓✓wav
FLAC✓-flac
MP3✓-mp3
OGG Vorbis✓-ogg
AAC✓-aac

Note: Currently all formats decode to WAV. Encoders for other formats are planned.

Feature Groups ​

toml
# Cargo.toml for paraphase-audio
[features]
default = ["wav", "flac", "mp3", "ogg"]
all = ["wav", "flac", "mp3", "ogg", "aac"]

CLI usage:

bash
# Convert MP3 to WAV
paraphase convert song.mp3 song.wav

# Convert FLAC to WAV
paraphase convert album.flac album.wav

# Convert OGG to WAV
paraphase convert audio.ogg audio.wav

Video Formats (paraphase-video) ​

All video formats use FFmpeg as the transcoding backend. Requires FFmpeg installed at runtime.

Container Formats ​

FormatFeatureExtensionsDefault Codecs
MP4mp4.mp4, .m4vH.264 + AAC
WebMwebm.webmVP9 + Opus
MKVmkv.mkvH.264 + AAC
AVIavi.aviMPEG-4 + MP3
MOVmov.mov, .qtH.264 + AAC
GIFgif.gifGIF (animated)

Feature Groups ​

toml
# Cargo.toml for paraphase-video
[features]
default = ["mp4", "webm", "gif"]
all = ["mp4", "webm", "mkv", "avi", "mov", "gif", "audio"]

Video Transforms ​

ConverterDescriptionOptions
video.resizeResize videomax_width, max_height, scale

Quality Presets ​

PresetCRFUse Case
low28Smaller file size
medium23Balanced (default)
high18Higher quality
lossless0No quality loss

CLI usage:

bash
# Convert MP4 to WebM
paraphase convert video.mp4 video.webm

# Convert with quality preset
paraphase convert video.mp4 video.webm --quality high

# Resize video
paraphase convert video.mp4 small.mp4 --max-width 720

# GIF to video
paraphase convert animation.gif video.mp4

CLI Feature Flags ​

The CLI combines all converter backends:

toml
# Cargo.toml for paraphase-cli
[features]
default = ["serde", "image"]

# Include backends
serde = ["dep:paraphase-serde"]
image = ["dep:paraphase-image"]
video = ["dep:paraphase-video"]  # Requires FFmpeg
audio = ["dep:paraphase-audio"]

# Enable all formats per backend
serde-all = ["serde", "paraphase-serde/all"]
image-all = ["image", "paraphase-image/all"]
video-all = ["video", "paraphase-video/all"]
audio-all = ["audio", "paraphase-audio/all"]

# Everything (video excluded from default, requires FFmpeg)
all = ["serde-all", "image-all", "video-all", "audio-all"]

Installation Examples ​

bash
# Default: common serde + common image formats
cargo install paraphase-cli

# All formats
cargo install paraphase-cli --features all

# Only serde formats (no image support)
cargo install paraphase-cli --no-default-features --features serde-all

# Only image formats (no serde support)
cargo install paraphase-cli --no-default-features --features image-all

# Specific formats only
cargo install paraphase-cli --no-default-features \
  --features paraphase-serde/json,paraphase-serde/yaml,paraphase-image/png

Converter Naming ​

Converters follow the pattern {crate}.{from}-to-{to}:

  • serde.json-to-yaml
  • serde.toml-to-msgpack
  • image.png-to-webp
  • image.jpg-to-gif

List all available converters:

bash
paraphase list

Adding Custom Converters ​

Implement the Converter trait:

rust
use paraphase::{Converter, ConverterDecl, ConvertError, ConvertOutput, Properties, PropertyPattern};

pub struct MyConverter {
    decl: ConverterDecl,
}

impl MyConverter {
    pub fn new() -> Self {
        let decl = ConverterDecl::simple(
            "my.foo-to-bar",
            PropertyPattern::new().eq("format", "foo"),
            PropertyPattern::new().eq("format", "bar"),
        ).description("Convert foo to bar");

        Self { decl }
    }
}

impl Converter for MyConverter {
    fn decl(&self) -> &ConverterDecl {
        &self.decl
    }

    fn convert(&self, input: &[u8], props: &Properties) -> Result<ConvertOutput, ConvertError> {
        // Transform input bytes to output bytes
        let output = transform(input)?;

        let mut out_props = props.clone();
        out_props.insert("format".into(), "bar".into());

        Ok(ConvertOutput::Single(output, out_props))
    }
}

Register with a registry:

rust
let mut registry = Registry::new();
registry.register(MyConverter::new());