https://github.com/mrange/fsdistancefield
Computes a distance field PNG from an input image
https://github.com/mrange/fsdistancefield
Last synced: about 1 year ago
JSON representation
Computes a distance field PNG from an input image
- Host: GitHub
- URL: https://github.com/mrange/fsdistancefield
- Owner: mrange
- License: bsd-2-clause
- Created: 2022-10-01T05:52:56.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-26T06:22:28.000Z (over 1 year ago)
- Last Synced: 2025-04-02T02:09:04.950Z (about 1 year ago)
- Language: F#
- Size: 148 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FsDistanceField
Computes a distance field PNG from an input image.
Distance fields are commonly used in shader world where it can be used to create decals and other graphics that dont' get blurry upon scaling and support things like drop shadow, inner glow, outer glow and so on "for free".
## Install
```bash
# Install the tool globally
dotnet tool install -g FsDistanceField
# Print the help
create-distance-field --help
# Should respond with this
# Description:
# Computes a distance field image from an input image
#
# Usage:
# create-distance-field [options]
#
# Options:
# --version Show version information
# -?, -h, --help Show help and usage information
# -i, --input (REQUIRED) Input image file to compute distance field for
# -o, --output (REQUIRED) Output PNG file to for the distance field
# -r, --radius Radius of distance field in pixels [default: 32]
# -c, --cutoff Cutoff of distance field [default: 0.25]
# -p, --padding Padding applied to distance field image [default: 0]
# -y, --overwrite Overwrite existing file [default: False]
```
## Build & Run
```bash
cd src/FsDistanceField
# Print help screen
dotnet run -- -h
# Generate blazor distance field
dotnet run -c Release -- -i ../../assets/Blazor.png -o ../../assets/Blazor_distance.png -r 200 -c 0.5 -y true
```
## Licensed software
### FsDistanceField
BSD 2-Clause License
Copyright (c) 2022, Mårten Rånge
github : https://github.com/mrange/FsDistanceField
license: https://github.com/mrange/FsDistanceField/LICENSE
### Distance field algorithm based on tiny-sdf (Mapbox)
Copyright © 2016-2021 Mapbox, Inc.
This code available under the terms of the BSD 2-Clause license.
github : https://github.com/mapbox/tiny-sdf
license: https://github.com/mapbox/tiny-sdf/blob/main/LICENSE.txt
### Image processing library (SixLabors.ImageSharp)
Six Labors Split License
Version 1.0, June 2022
Copyright (c) Six Labors
Uses the Apache License, Version 2.0 branch of the Six Labors Split License as:
- FsDistanceField is fulfilling the requirement: You are consuming the Work in for use in software licensed under an Open Source or Source Available license.
github : https://github.com/SixLabors/ImageSharp
license: https://github.com/SixLabors/ImageSharp/blob/main/LICENSE