This is a snapshot of a work-in-progress documentation theme. If you feel lost, miss something, or want to see the original Doxygen docs instead, head over to the archived version of this documentation page.

Utilities » Distance Field conversion utility

Converts red channel of an image to distance field representation.


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


  • 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 — base plugin dir (defaults to plugin directory in Magnum install location)
  • --output-size "X Y" — size of output image
  • --radius N — distance field computation radius
  • --magnum-... — engine-specific options (see Context for details)

Images with PixelFormat::Red, PixelFormat::RGB or PixelFormat::RGBA 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.