graphicsmagick

package
v0.0.0-...-b98e79d Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package graphicsmagick provides a GraphicsMagick imageserver.Handler implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// Executable is the path to "gm" executable, usually "/usr/bin/gm".
	Executable string

	// Timeoput is an optional timeout for process.
	Timeout time.Duration

	// TempDir is an optional temp directory for image files.
	TempDir string

	// AllowedFormats is an optional list of allowed formats.
	AllowedFormats []string
}

Handler is a GraphicsMagick imageserver.Handler implementation.

It processes the Image with the GraphicsMagick command line (mogrify command).

All params are extracted from the "graphicsmagick" node param and are optionals.

Params (see GraphicsMagick documentation for more information about arguments):

  • width / height: sizes for "-resize" argument (both optionals)
  • fill: "^" for "-resize" argument
  • ignore_ratio: "!" for "-resize" argument
  • only_shrink_larger: ">" for "-resize" argument
  • only_enlarge_smaller: "<" for "-resize" argument
  • background: color for "-background" argument, 3/4/6/8 lower case hexadecimal characters
  • extent: "-extent" param, uses width/height params and add "-gravity center" argument
  • format: "-format" param
  • quality: "-quality" param

func (*Handler) Handle

func (hdr *Handler) Handle(im *imageserver.Image, params imageserver.Params) (*imageserver.Image, error)

Handle implements imageserver.Handler.

Jump to

Keyboard shortcuts

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