Skip to content

ArcaneArts/transmute

Repository files navigation

transmute

transmute is an endorsement package that re-exports four Dart clients behind a single dependency. Add transmute when you want one import surface for document text extraction, image processing, GIF tooling, and FFmpeg-style media work.

It currently exports:

  • tika for Apache Tika document text extraction
  • image_magick for ImageMagick image inspection and transforms
  • gifsicle for GIF inspection, optimization, merging, and frame operations
  • mpeg for ffmpeg and ffprobe process access, probing, transcoding, remuxing, and frame extraction

transmute does not bundle those native tools for you. It re-exports the Dart APIs, and the host machine or container still needs the matching system dependencies installed.

Add the package

dart pub add transmute

Then import the umbrella package:

import 'package:transmute/transmute.dart';

What you get

Because transmute re-exports the underlying libraries directly, you use the same classes and methods documented in each package README:

  • TikaClient for extracting text from PDFs, DOCX files, and other supported documents through Apache Tika
  • ImageMagickClient for format inspection, resize, crop, convert, rotate, flip, and metadata stripping
  • GifsicleClient for GIF metadata, optimization, resizing, merging, exploding into frames, and frame extraction
  • MpegClient for ffmpeg and ffprobe version checks, probing, transcoding, remuxing, and thumbnail extraction

Quick example

import 'package:transmute/transmute.dart';

Future<void> main() async {
  TikaClient tika = TikaClient();
  ImageMagickClient images = ImageMagickClient();
  GifsicleClient gifs = GifsicleClient();
  MpegClient media = MpegClient();

  String text = await tika.readText(
    documentPath: '/tmp/report.pdf',
  );

  await images.resize(
    inputPath: '/tmp/input.png',
    outputPath: '/tmp/output.webp',
    width: 1200,
    onlyShrink: true,
    format: 'webp',
  );

  await gifs.optimize(
    inputPath: '/tmp/input.gif',
    outputPath: '/tmp/output.gif',
    maxDimension: 512,
    lossy: 80,
  );

  await media.extractFrame(
    inputPath: '/tmp/video.mov',
    outputPath: '/tmp/thumbnail.png',
    position: const Duration(seconds: 1),
    width: 320,
    height: 180,
  );

  print(text);
}

Runtime requirements

To use all four re-exported clients, your runtime environment needs:

  • Java plus Apache Tika available as tika on PATH, or a downloaded tika-app.jar used with TikaClient.jar(...)
  • ImageMagick available as magick, or the legacy convert and identify commands
  • gifsicle on PATH
  • ffmpeg and ffprobe on PATH

If one of those binaries is missing, the corresponding client will fail when it tries to launch the process.

Docker setup for all 4 tools

This is a copy-paste friendly Debian or Ubuntu style setup that installs everything transmute needs in one image.

FROM dart:stable

ARG TIKA_VERSION=3.3.0

RUN apt-get update \
 && apt-get install -y --no-install-recommends \
    ca-certificates \
    curl \
    default-jre-headless \
    ffmpeg \
    gifsicle \
    imagemagick \
 && rm -rf /var/lib/apt/lists/*

RUN mkdir -p /opt/tika \
 && curl -fsSL "https://archive.apache.org/dist/tika/${TIKA_VERSION}/tika-app-${TIKA_VERSION}.jar" \
    -o /opt/tika/tika-app.jar \
 && printf '#!/bin/sh\nexec java -jar /opt/tika/tika-app.jar "$@"\n' > /usr/local/bin/tika \
 && chmod +x /usr/local/bin/tika

WORKDIR /app
COPY pubspec.* ./
RUN dart pub get

COPY . .
CMD ["dart", "run"]

That setup gives you:

  • tika through a small wrapper script around java -jar /opt/tika/tika-app.jar
  • magick for ImageMagick
  • gifsicle
  • ffmpeg and ffprobe

If you would rather skip the wrapper script, keep the jar on disk and use:

TikaClient tika = TikaClient.jar(
  jarPath: '/opt/tika/tika-app.jar',
);

Optional verification inside the container:

tika --version
magick -version
gifsicle --version
ffmpeg -version
ffprobe -version

macOS setup for all 4 tools

Homebrew is the simplest way to install the full stack locally:

brew install tika imagemagick gifsicle ffmpeg

Verify the installs:

tika --version
magick -version
gifsicle --version
ffmpeg -version
ffprobe -version

If your ImageMagick install exposes the legacy commands, these may also be available:

convert -version
identify -version

After that, the default constructors work as expected:

TikaClient tika = TikaClient();
ImageMagickClient images = ImageMagickClient();
GifsicleClient gifs = GifsicleClient();
MpegClient media = MpegClient();

More details on each package

transmute is intentionally thin. For the full API surface, detailed examples, and package-specific setup notes, see:

Notes

  • transmute is best suited to server-side Dart, CLI apps, Docker containers, and macOS or Linux environments where those native tools can be installed.
  • gifsicle can also be pointed at a Docker-backed command prefix if you prefer to run that tool through docker run ... gifsicle instead of a local binary.
  • mpeg supports custom executable paths, environment variables, and working directories when your deployment environment needs non-default process wiring.

About

Translate your code into that other guy's language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages