Utilities » Distance Field conversion utility

Converts red channel of an image to distance field representation.

Usage

magnum-distancefieldconverter [--magnum-...] [-h|--help] [--importer IMPORTER]
    [--converter CONVERTER] [--plugin-dir DIR] --output-size "X Y" --radius N
    [--] input output

Arguments:

  • input — input image
  • output — output image
  • -h, --help — display help message and exit
  • --importer IMPORTER — image importer plugin (default: AnyImageImporter)
  • --converter CONVERTER — image converter plugin (default: AnyImageConverter)
  • --plugin-dir DIR — override base plugin dir
  • --output-size "X Y" — size of output image
  • --radius N — distance field computation radius
  • --magnum-... — engine-specific options (see Command-line options for details)

Images with PixelFormat::R8Unorm, PixelFormat::RGB8Unorm or PixelFormat::RGBA8Unorm are accepted on input.

The resulting image can be then used with Shaders::DistanceFieldVector shader. See also TextureTools::distanceField() for more information about the algorithm and parameters.

Example usage

magnum-distancefieldconverter --output-size "256 256" --radius 24 logo-src.png logo.png

This will open monochrome logo-src.png image using any plugin that can open PNG files and converts it to 256x256 distance field logo.png using any plugin that can write PNG files.