rasterasset

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package rasterasset validates manager-side image input without file/network access, HTML parsing, panel dependencies or early monochrome composition.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConfiguration = errors.New("rasterasset: invalid limits")
	ErrSource        = errors.New("rasterasset: expected canonical raster data URL")
	ErrLimit         = errors.New("rasterasset: image exceeds limit")
	ErrImage         = errors.New("rasterasset: invalid raster image")
)

Functions

func DecodeDataURL

func DecodeDataURL(src string, limits Limits) (image.Image, error)

DecodeDataURL accepts only data:image/png;base64, with padded RFC4648 standard base64 and no whitespace. It returns caller-owned pixels with alpha intact; the renderer must composite against the actual scene before thresholding. No URL resolver, global image decoder registry, or source metadata is exposed.

func DecodeJPEGDataURL

func DecodeJPEGDataURL(src string, limits Limits) (image.Image, error)

DecodeJPEGDataURL accepts canonical JPEG data URLs with the same allocation limits as PNG. JPEG is opaque and lossy; it is not compared pixel-for-pixel with its pre-encoding source. DecodeConfig precedes pixel allocation. https://pkg.go.dev/image#hdr-Security_Considerations

Types

type Limits

type Limits struct {
	MaxURLBytes, MaxPNGBytes, MaxDimension, MaxPixels int
}

Limits are positive administrator-supplied per-image bounds, not HTML values. MaxURLBytes includes the prefix/base64; MaxPNGBytes bounds the decoded source file, not its pixels (the legacy field name also applies to JPEG). Callers must also enforce a document-wide asset budget.

Jump to

Keyboard shortcuts

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