png

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MPL-2.0 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

Index

Constants

View Source
const SCALE = 2.

SCALE is the static raster device scale used by PNG, PDF, and PPTX export.

Variables

This section is empty.

Functions

func AddExif

func AddExif(png []byte) ([]byte, error)

AddExif returns png with D2's EXIF metadata inserted after IHDR. An existing EXIF chunk is replaced at its original position. The input is validated without copying chunk payloads so peak memory remains one input and one output buffer.

func AddExifInPlace added in v0.9.0

func AddExifInPlace(png []byte) ([]byte, error)

AddExifInPlace returns png with D2's EXIF metadata inserted after IHDR. It reuses the input's backing storage when it has sufficient spare capacity and otherwise allocates an exact-sized result. On success, callers must consider the input and every alias of its backing storage consumed. Invalid input is never modified.

func AddExifToEncoderOutputInPlace added in v0.9.0

func AddExifToEncoderOutputInPlace(png []byte) ([]byte, error)

AddExifToEncoderOutputInPlace inserts D2's EXIF metadata into a PNG emitted directly by an encoder. Unlike AddExifInPlace, it does not rescan and checksum every generated image-data chunk. It still verifies the fixed PNG envelope before modifying the input. Callers must not use it for untrusted or externally supplied PNG data.

func WriteExif added in v0.9.0

func WriteExif(w io.Writer) error

WriteExif writes D2's complete eXIf chunk. A streaming PNG encoder calls it after IHDR, before emitting image data, without retaining the encoded image.

Types

This section is empty.

Jump to

Keyboard shortcuts

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