imagefile

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 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 imagefile tells what picture some bytes are and what file name to write them under, for every place that writes a picture out of a model.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckSVG

func CheckSVG(data []byte) error

CheckSVG is nil when data is one well-formed SVG document — a single root element svg in the SVG namespace and no text outside it — else why it is not.

func CheckStaticSVG

func CheckStaticSVG(data []byte) error

CheckStaticSVG is nil when data is one well-formed SVG document without active content that can execute or load external resources.

func ContentType

func ContentType(data []byte) string

ContentType is the type data's signature gives when it is one of the images written (PNG, JPEG, GIF, BMP, WebP), image/svg+xml for one well-formed SVG document, or "" when data is no such image.

func DecodeDataURL

func DecodeDataURL(u string) (mediaType string, data []byte, err error)

DecodeDataURL decodes a data URL and reports its declared media type, if any.

func Name

func Name(name, fallback, ct string) string

Name is the file name for an image of type ct: the base of name, else of fallback, else "image", given the type's suffix unless it carries one already.

Types

type ActiveContentError

type ActiveContentError struct {
	Construct string
}

ActiveContentError is an SVG construct that can load or execute active content.

func (*ActiveContentError) Error

func (e *ActiveContentError) Error() string

Jump to

Keyboard shortcuts

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