magick: github.com/quirkey/magick Index | Files | Directories

package magick

import "github.com/quirkey/magick"

Package magick implements image manipulation routines based on the ImageMagick MagickCore C library. It is an opinionated high level wrapper around the proven ImageMagick lib.

magick's goal is to provide quick processing of images in ways most commonly used by photo and other image based applications. It is not the intention to implement the very large number of methods that MagickCore has to offer, rather just the most common needs for basic applications. It requires ImageMagick-devel libraries to be available in order to compile.

Index

Package Files

magick.go

func ErrorFromExceptionInfo Uses

func ErrorFromExceptionInfo(exception *C.ExceptionInfo) (err error)

type MagickError Uses

type MagickError struct {
    Severity    string
    Reason      string
    Description string
}

func (*MagickError) Error Uses

func (err *MagickError) Error() string

type MagickGeometry Uses

type MagickGeometry struct {
    Width, Height, Xoffset, Yoffset int
}

Geometry is usually defined as a string of WxH+X+Y

type MagickImage Uses

type MagickImage struct {
    Image     (*C.Image)
    ImageInfo (*C.ImageInfo)
}

A wrapper around an IM Image

func NewFromBlob Uses

func NewFromBlob(blob []byte, extension string) (im *MagickImage, err error)

NewFromBlob takes a byte slice of image data and an extension that defines the image type (e.g. "png", "jpg", etc). It loads the image data and returns a MagickImage. The extension is required so that Magick knows what processor to use.

func NewFromFile Uses

func NewFromFile(filename string) (im *MagickImage, err error)

NewFromFile loads a file at filename into a MagickImage. Exceptions are returned as MagickErrors.

func (*MagickImage) Crop Uses

func (im *MagickImage) Crop(geometry string) (err error)

Crop crops the image based on the geometry string passed and stores the cropped image in place For more info about Geometry see http://www.imagemagick.org/script/command-line-processing.php#geometry

func (*MagickImage) Destroy Uses

func (im *MagickImage) Destroy() (err error)

Destroy frees the C memory for the image. Should be called after processing is done.

func (*MagickImage) FillBackgroundColor Uses

func (im *MagickImage) FillBackgroundColor(color string) (err error)

FillBackgroundColor fills transparent areas of an image with a solid color and stores the filled image in place. color can be any color format that image magick understands, see: http://www.imagemagick.org/ImageMagick-7.0.0/script/color.php#models

func (*MagickImage) GetProperty Uses

func (im *MagickImage) GetProperty(prop string) (value string)

GetProperty() retreives the given attribute or freeform property string on the underlying Image

func (*MagickImage) Height Uses

func (im *MagickImage) Height() int

Height returns the Height of the loaded image in pixels as an int

func (*MagickImage) Negate Uses

func (im *MagickImage) Negate() (err error)

Negate inverts the colors in the image

func (*MagickImage) ParseGeometry Uses

func (im *MagickImage) ParseGeometry(geometry string) (info *MagickGeometry, err error)

ParseGeometry uses ParseGeometryToRectangleInfo to convert from a geometry string into a MagickGeometry

func (*MagickImage) ParseGeometryToRectangleInfo Uses

func (im *MagickImage) ParseGeometryToRectangleInfo(geometry string) (info C.RectangleInfo, err error)

ParseGeometryToRectangleInfo converts from a geometry string (WxH+X+Y) into a Magick RectangleInfo that contains the individual properties

func (*MagickImage) Progressive Uses

func (im *MagickImage) Progressive()

Progessive() is a shortcut for making the underlying image a Plane interlaced Progressive JPG

func (*MagickImage) Quality Uses

func (im *MagickImage) Quality(quality int)

func (*MagickImage) ReplaceImage Uses

func (im *MagickImage) ReplaceImage(new_image *C.Image)

ReplaceImage Replaces the underlying image, freeing the old one

func (*MagickImage) Resize Uses

func (im *MagickImage) Resize(geometry string) (err error)

Resize resizes the image based on the geometry string passed and stores the resized image in place For more info about Geometry see http://www.imagemagick.org/script/command-line-processing.php#geometry

func (*MagickImage) ResizeRatio Uses

func (im *MagickImage) ResizeRatio(width, height int) float64

ResizeRatio() returns the ratio that the size you want to resize to defined by width/height is over the size of the underlying Image

func (*MagickImage) SeparateAlphaChannel Uses

func (im *MagickImage) SeparateAlphaChannel() (err error)

SeparateAlphaChannel replaces the Image with grayscale data from the image's Alpha Channel values

func (*MagickImage) SetProperty Uses

func (im *MagickImage) SetProperty(prop, value string) (err error)

SetProperty() saves the given string value either to specific known attribute or to a freeform property string on the underlying Image

func (*MagickImage) Shadow Uses

func (im *MagickImage) Shadow(color string, opacity, sigma float32, xoffset, yoffset int) (err error)

Shadow adds a dropshadow to the current (transparent) image and stores the shadowed image in place For more information about shadow options see: http://www.imagemagick.org/Usage/blur/#shadow

func (*MagickImage) Strip Uses

func (im *MagickImage) Strip() (err error)

Strip strips the image of its extra meta (exif) data

func (*MagickImage) ToBlob Uses

func (im *MagickImage) ToBlob(extension string) (blob []byte, err error)

ToBlob takes a (transformed) MagickImage and returns a byte slice in the format you specify with extension. Magick uses the extension to transform the image in to the proper encoding (e.g. "jpg", "png")

func (*MagickImage) ToFile Uses

func (im *MagickImage) ToFile(filename string) (err error)

ToFile writes the (transformed) MagickImage to the regular file at filename. Magick determines the encoding of the output file by the extension given to the filename (e.g. "image.jpg", "image.png")

func (*MagickImage) Type Uses

func (im *MagickImage) Type() (t string)

Type returns the underlying encoding or "magick" of the image as a string

func (*MagickImage) Width Uses

func (im *MagickImage) Width() int

Width returns the Width of the loaded image in pixels as an int

Directories

PathSynopsis
examples

Package magick imports 6 packages (graph) and is imported by 6 packages. Updated 2016-07-21. Refresh now. Tools for package owners.