imagick

module
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2016 License: BSD-3-Clause

README

Go Imagick

GoDoc

Go Imagick is a Go bind to ImageMagick's MagickWand C API.

We support two compatibility branches:

master (tag v2.x.x): >= ImageMagick 6.8.9
legacy (tag v1.x.x): <= ImageMagick 6.8.8

They map, respectively, through gopkg.in:

gopkg.in/gographics/imagick.v2/imagick
gopkg.in/gographics/imagick.v1/imagick

Install

Mac OS X

MacPorts
sudo port install ImageMagick

Ubuntu / Debian

sudo apt-get install libmagickwand-dev

Common

Check if pkg-config is able to find the right ImageMagick include and libs:

pkg-config --cflags --libs MagickWand

Then go get it:

go get gopkg.in/gographics/imagick.v1/imagick
Build tags

If you want to specify CGO_CFLAGS/CGO_LDFLAGS manually at build time, such as for building statically or without pkg-config, you can use the "no_pkgconfig" build tag:

go build -tags no_pkgconfig gopkg.in/gographics/imagick.v1/imagick

Examples

The examples folder is full with usage examples ported from C ones found in here: http://members.shaw.ca/el.supremo/MagickWand/

Quick and partial example

Since this is a CGO binding, Go GC does not manage memory allocated by the C API then is necessary to use Terminate() and Destroy() methods. But objects of MagickWand, DrawingWand, PixelIterator and PixelWand are managed by GO GC if you create them by constructors.

package main

import "gopkg.in/gographics/imagick.v1/imagick"

func main() {
    imagick.Initialize()
    defer imagick.Terminate()

    mw := imagick.NewMagickWand()

    ...
}

If you use struct literals, you should free resources manually:

package main

import "github.com/gographics/imagick/imagick"

func main() {
    imagick.Initialize()
    defer imagick.Terminate()

    mw := imagick.MagickWand{...}
    defer mw.Destroy()

    ...
}

Both methods are compatible if constructor methods used:

package main

import "github.com/gographics/imagick/imagick"

func main() {
    imagick.Initialize()
    defer imagick.Terminate()

    mw := imagick.NewMagickWand()
    defer mw.Destroy()

    ...
}

But you should NOT mix two ways of object creation:

package main

import "github.com/gographics/imagick/imagick"

func main() {
    imagick.Initialize()
    defer imagick.Terminate()

    mw1 := imagick.MagickWand{...}
    defer mw1.Destroy()

    mw2 := imagick.NewMagickWand()

    ...
}

License

Copyright (c) 2013-2014, The GoGraphics Team All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the organization nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL HERBERT G. FISCHER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Directories

Path Synopsis
examples
3dlogo
Port of http://members.shaw.ca/el.supremo/MagickWand/3dlogo.htm to Go
Port of http://members.shaw.ca/el.supremo/MagickWand/3dlogo.htm to Go
affine
Port of http://members.shaw.ca/el.supremo/MagickWand/affine.htm to Go
Port of http://members.shaw.ca/el.supremo/MagickWand/affine.htm to Go
bunny
Port of lmembers.shaw.ca/el.supremo/MagickWand/bunny.htm to Go
Port of lmembers.shaw.ca/el.supremo/MagickWand/bunny.htm to Go
clipmask
Port of http://members.shaw.ca/el.supremo/MagickWand/clipmask.htm to Go
Port of http://members.shaw.ca/el.supremo/MagickWand/clipmask.htm to Go
cyclops
Port of http://members.shaw.ca/el.supremo/MagickWand/cyclops.htm to Go
Port of http://members.shaw.ca/el.supremo/MagickWand/cyclops.htm to Go
draw_shapes
Port of http://members.shaw.ca/el.supremo/MagickWand/draw_shapes.htm to Go
Port of http://members.shaw.ca/el.supremo/MagickWand/draw_shapes.htm to Go
extend
Port of http://members.shaw.ca/el.supremo/MagickWand/extent.htm to Go
Port of http://members.shaw.ca/el.supremo/MagickWand/extent.htm to Go
floodfill
Port of http://members.shaw.ca/el.supremo/MagickWand/floodfill.htm to Go
Port of http://members.shaw.ca/el.supremo/MagickWand/floodfill.htm to Go
fontmetrics
Port of http://members.shaw.ca/el.supremo/MagickWand/fontmetrics.htm to Go
Port of http://members.shaw.ca/el.supremo/MagickWand/fontmetrics.htm to Go
gel
Port of http://members.shaw.ca/el.supremo/MagickWand/gel.htm to Go
Port of http://members.shaw.ca/el.supremo/MagickWand/gel.htm to Go
grayscale
Port of http://members.shaw.ca/el.supremo/MagickWand/grayscale.htm to Go
Port of http://members.shaw.ca/el.supremo/MagickWand/grayscale.htm to Go
landscape3d
Port of http://members.shaw.ca/el.supremo/MagickWand/landscape_3d.htm to Go
Port of http://members.shaw.ca/el.supremo/MagickWand/landscape_3d.htm to Go
make_tile
Port of http://members.shaw.ca/el.supremo/MagickWand/make_tile.htm to Go
Port of http://members.shaw.ca/el.supremo/MagickWand/make_tile.htm to Go
modulate
Port of http://members.shaw.ca/el.supremo/MagickWand/modulate.htm to Go
Port of http://members.shaw.ca/el.supremo/MagickWand/modulate.htm to Go
pixel_mod
Port of http://members.shaw.ca/el.supremo/MagickWand/pixel_mod.htm to Go
Port of http://members.shaw.ca/el.supremo/MagickWand/pixel_mod.htm to Go
reflect
Port of http://members.shaw.ca/el.supremo/MagickWand/reflect.htm to Go
Port of http://members.shaw.ca/el.supremo/MagickWand/reflect.htm to Go
resize
Port of http://members.shaw.ca/el.supremo/MagickWand/resize.htm to Go
Port of http://members.shaw.ca/el.supremo/MagickWand/resize.htm to Go
round_mask
Port of http://members.shaw.ca/el.supremo/MagickWand/round_mask.htm to Go
Port of http://members.shaw.ca/el.supremo/MagickWand/round_mask.htm to Go
text_effects
Port of http://members.shaw.ca/el.supremo/MagickWand/text_effects.htm to Go
Port of http://members.shaw.ca/el.supremo/MagickWand/text_effects.htm to Go
tilt_shift
Port from http://members.shaw.ca/el.supremo/MagickWand/tilt_shift.htm to Go
Port from http://members.shaw.ca/el.supremo/MagickWand/tilt_shift.htm to Go
trans_paint
Port of http://members.shaw.ca/el.supremo/MagickWand/trans_paint.htm to Go
Port of http://members.shaw.ca/el.supremo/MagickWand/trans_paint.htm to Go

Jump to

Keyboard shortcuts

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