isdf

package module
v0.0.0-...-257e5b9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2020 License: MIT Imports: 3 Imported by: 0

README

isdf

Single-function package which takes an input image.Image and returns an *image.Gray16 Signed Distance Field representation. See example code for simple usage in a command line app.

img1

This code has been adpated from image-sdf.

Usage Example

package main

import (
  ...
  "github.com/vrav/isdf"
)

func main() {
  // import an image, decode it if necessary
  // see isdf-example.go for an example
  ...
  
  // convert to 1/4 size SDF image with spread of 32
  sdfImage := isdf.ImageToSDF(inputImage, 32.0, 4.0)
  
  // continue on to save the image or use as-is
  ...
}

License

MIT, see LICENSE.md for details.

Documentation

Overview

Package isdf provides a single function to convert an input image into its Signed Distance Field representation. See https://github.com/mattdesl/image-sdf for the reference implementation used.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ImageToSDF

func ImageToSDF(src image.Image, spread, downscale float64) *image.Gray16

ImageToSDF converts an image using the image.Image interface to its Signed Distance Field representation. Spread affects the width of the distance fields while downscale decreases the resolution of the output image. A downscale value of 2.0 will turn a 512px image to 256px; 4.0 will result in a 128px output image. Converting from a high resolution image to a low resolution image results in better quality.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL