magick

package
v1.8.13 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2025 License: MIT Imports: 22 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HasMagick = sync.OnceValue(func() bool { return MagickExe() != "magick" })
View Source
var MagickExe = sync.OnceValue(func() string {
	ans, err := exec.LookPath("magick")
	if err != nil || ans == "" {
		ans = "magick"
	}
	return ans
})
View Source
var TempDirInRAMIfPossible = sync.OnceValue(func() string {
	if shm.SHM_DIR != "" {
		tempFile, err := os.CreateTemp(shm.SHM_DIR, "write_check_*")
		if err != nil {
			return os.TempDir()
		}
		tempFile.Close()
		os.Remove(tempFile.Name())
		return shm.SHM_DIR
	}
	return os.TempDir()
})

Functions

func RunMagick

func RunMagick(i *input, cmd []string) ([]byte, error)

Types

type DisposeOp

type DisposeOp int
const (
	DisposeNone DisposeOp = iota
	DisposeBackground
	DisposePrevious
)

type IdentifyOutput

type IdentifyOutput struct {
	Fmt, Canvas, Transparency, Gap, Index, Size, Dpi, Dispose, Orientation, Colorspace string
}

type IdentifyRecord

type IdentifyRecord struct {
	Fmt_uppercase      string
	Gap                int
	Canvas             struct{ Width, Height, Left, Top int }
	Width, Height      int
	Dpi                struct{ X, Y float64 }
	Index              int
	Is_opaque          bool
	Needs_blend        bool
	Disposal           DisposeOp
	Dimensions_swapped bool
	ColorSpace         string
}

type Image

type Image struct {
	Frames           []*ImageFrame
	Format_uppercase string
}

func OpenAll

func OpenAll(input *types.Input, md *meta.Data, callback func(w, h int) RenderOptions) (ans *Image, err error)

type ImageFrame

type ImageFrame struct {
	Width, Height, Left, Top int
	Number                   int   // 1-based number
	Compose_onto             int   // number of frame to compose onto
	Delay_ms                 int32 // negative for gapless frame, zero ignored, positive is number of ms
	Replace                  bool  // do a replace rather than an alpha blend
	Is_opaque                bool
	Img                      image.Image
}

type RenderOptions

type RenderOptions struct {
	Background             *color.RGBA64
	ResizeTo               image.Point
	OnlyFirstFrame         bool
	AutoOrient             bool
	ToSRGB                 bool
	Transform              types.TransformType
	RenderingIntent        icc.RenderingIntent
	BlackpointCompensation bool
}

Jump to

Keyboard shortcuts

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