images

package module
v0.0.0-...-fa336cc Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2016 License: MIT Imports: 4 Imported by: 0

README

Images (binding for Image-Magick)

Build Status GoDoc Software License

This not stable version

Installation

$ go get github.com/mantyr/golang-magick
$ go get github.com/mantyr/images-imagick

Example

package main

import (
    images "github.com/mantyr/images-imagick"
    "fmt"
)

func main() {
    address := "file.png"

    image, err := images.Open(address)
    if err != nil {
        fmt.Println(err)
        return
    }

    w := image.Width()
    h := image.Height()
    w = int(w/2)
    h = int(h/2)

    address = "file.gif"

    err = image.ResizeIn(w, h).SetGif().SetQuality(100).Save(address)
    if err != nil {
        fmt.Println(err)
        return
    }
    image.Dispose()  // It is very important, otherwise it will be a memory leak
}

Author

Oleg Shevelev

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDir

func IsDir(path string) (status bool)

Types

type Image

type Image struct {
	Image   *mag.Image
	Address string
	Format  string
	Quality int

	Error error
	// contains filtered or unexported fields
}

func Open

func Open(address string) (i *Image, err error)

func (*Image) Dispose

func (i *Image) Dispose()

func (*Image) Height

func (i *Image) Height() int

func (*Image) Resize

func (i *Image) Resize(width int, height int) (image *Image)

func (*Image) ResizeIn

func (i *Image) ResizeIn(width int, height int) (image *Image)

func (*Image) Save

func (i *Image) Save(address string) (err error)

func (*Image) SetGif

func (i *Image) SetGif() *Image

func (*Image) SetJpeg

func (i *Image) SetJpeg() *Image

func (*Image) SetPng

func (i *Image) SetPng() *Image

func (*Image) SetQuality

func (i *Image) SetQuality(quality int) *Image

func (*Image) SetTiff

func (i *Image) SetTiff() *Image

func (*Image) Width

func (i *Image) Width() int

Jump to

Keyboard shortcuts

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