// Terminates the MagickWand environment func Terminate() { if initialized { C.free(unsafe.Pointer(dumb)) C.DestroyMagick() initialized = false } }
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") }
func cleanup() { C.DestroyMagick() }
func CloseMagick() { C.DestroyMagick() }