Exemple #1
0
func main() {
	// Some GraphicsMagick boilerplate
	C.InitializeMagick(nil)
	defer C.DestroyMagick()
	C.GetExceptionInfo(&exceptionInfo)
	imageInfo = C.CloneImageInfo(nil)
	defer C.DestroyExceptionInfo(&exceptionInfo)
	defer C.DestroyImageInfo(imageInfo)

	// main OMIT

	Show("./cgo/armed_gopher.jpg")

	img, err := Read("./cgo/armed_gopher.jpg")
	if err != nil {
		fmt.Println(err)
		return
	}

	if img, err = Resize(img, 200, 800); err != nil {
		fmt.Println("resize error:", err)
		return
	}

	if err = Save(img, "./cgo/resized_gopher.jpg"); err != nil {
		fmt.Println("save error:", err)
		return
	}

	Show("./cgo/resized_gopher.jpg")
}
// Inicializes the MagickWand environment
func Initialize() {
	if initialized {
		return
	}
	dumb = C.CString(os.Args[0])
	//defer C.free(unsafe.Pointer(dumb))
	C.InitializeMagick(dumb)
	initialized = true
}
Exemple #3
0
func init() {
	C.InitializeMagick(nil)
}
func InitMagick() {
	C.InitializeMagick(nil)
}