package lottie
import "go.mau.fi/util/lottie"
Index ¶
- func Convert(ctx context.Context, input io.Reader, outputFilename string, outputWriter io.Writer, format string, width, height int, extraArgs ...string) error
- func FFmpegConvert(ctx context.Context, input io.Reader, outputFile string, width, height, fps int) (thumbnailData []byte, err error)
- func SetPath(path string)
- func Supported() bool
Functions ¶
func Convert ¶
func Convert(ctx context.Context, input io.Reader, outputFilename string, outputWriter io.Writer, format string, width, height int, extraArgs ...string) error
Convert converts lottie data an image or image(s) using lottieconverter.
Args:
- input: an io.Reader containing the lottie data to convert.
- outputFilename: the filename to write the output to.
- outputWriter: an io.Writer to write the output to.
- format: the output format. Can be one of: png, gif, or pngs.
- width: the width of the output image(s).
- height: the height of the output image(s).
- extraArgs: additional arguments to pass to lottieconverter.
The outputFilename and outputWriter parameters are mutually exclusive.
func FFmpegConvert ¶
func FFmpegConvert(ctx context.Context, input io.Reader, outputFile string, width, height, fps int) (thumbnailData []byte, err error)
FFmpegConvert converts lottie data to a video or image using ffmpeg.
This function should only be called if ffmpeg.Supported returns true.
Args:
- input: an io.Reader containing the lottie data to convert.
- outputFile: the filename to write the output to. Must have .webp or .webm extension.
- width: the width of the output video or image.
- height: the height of the output video or image.
- fps: the framerate of the output video.
Returns: the converted data as a *bytes.Buffer, the mimetype of the output, and the thumbnail data as a PNG.
func SetPath ¶
func SetPath(path string)
SetPath overrides the path to the lottieconverter binary.
func Supported ¶
func Supported() bool
Supported returns whether lottieconverter is available on the system.
lottieconverter is considered to be available if a binary called lottieconverter is found in $PATH, or if SetPath has been called explicitly with a non-empty path.
Source Files ¶
convert.go
- Version
- v0.8.6 (latest)
- Published
- Mar 16, 2025
- Platform
- linux/amd64
- Imports
- 10 packages
- Last checked
- 1 week ago –
Tools for package owners.