gosexy/canvas
is an image processing library based on ImageMagick's MagickWand, for the Go programming language.
This branch is compatible with ImageMagick 6.6.x, like the one included with Debian Squeeze.
Please check the master branch for ImageMagick 6.7.x.
Get the MagickWand development package
$ sudo aptitude install libmagickwand-dev
$ cd $GOPATH
$ mkdir -p github.com/gosexy
$ cd github.com/gosexy
$ git clone -b squeeze git://github.com/gosexy/canvas
$ go install github.com/gosexy/canvas
package main
import "github.com/gosexy/canvas"
func main() {
cv := canvas.New()
defer cv.Destroy()
// Opening some image from disk.
opened := cv.Open("examples/input/example.png")
if opened {
// Photo auto orientation based on EXIF tags.
cv.AutoOrientate()
// Creating a squared thumbnail
cv.Thumbnail(100, 100)
// Saving the thumbnail to disk.
cv.Write("examples/output/example-thumbnail.png")
}
}
=======
The ImageMagick's header files are required. If you're using brew
the installation is straightforward.
$ brew install imagemagick
Debian has an old version of MagickWand (6.6.x), this binding was built against 6.7.x. Please check out the squeeze branch to get a version that works on Debian Squeeze and probably other debian-based distros. This may not be required for Ubuntu.
Arch Linux already has a recent version of MagickWand.
$ sudo pacman -S extra/imagemagick
Please, follow the install from source tutorial.
After installing ImageMagick's header files, pull gocanvas from github:
$ go get github.com/gosexy/canvas
After installing, you can use go get -u github.com/gosexy/canvas
to keep up to date.
package main
import "github.com/gosexy/canvas"
func main() {
cv := canvas.New()
defer cv.Destroy()
// Opening some image from disk.
opened := cv.Open("examples/input/example.png")
if opened {
// Photo auto orientation based on EXIF tags.
cv.AutoOrientate()
// Creating a squared thumbnail
cv.Thumbnail(100, 100)
// Saving the thumbnail to disk.
cv.Write("examples/output/example-thumbnail.png")
}
}
$ go doc github.com/gosexy/canvas
Or you can browse it online.