// Destroy frees the C memory for the image. Should be called after processing is done. func (im *MagickImage) Destroy() (err error) { C.DestroyImage(im.Image) C.DestroyImageInfo(im.ImageInfo) im.Image = nil im.ImageInfo = nil return }
func unrefImage(image *C.Image) { if atomic.AddInt32((*int32)(unsafe.Pointer(&image.client_data)), -1) == 0 { mu.Lock() delete(liveImages, image) mu.Unlock() atomic.AddInt32(&live, -1) C.DestroyImage(image) } }
// Destroy frees the C memory for the image. Should be called after processing is done. func (im *MagickImage) Destroy() (err error) { if im.Image != nil { C.DestroyImage(im.Image) } if im.ImageInfo != nil { C.DestroyImageInfo(im.ImageInfo) } im.Image = nil im.ImageInfo = nil return }
func Resize(img *C.Image, x, y int) (*C.Image, error) { newImg := C.ResizeImage(img, C.ulong(x), C.ulong(y), C.LanczosFilter, 1.0, &exceptionInfo) if newImg == nil { C.CatchException(&exceptionInfo) return nil, fmt.Errorf(C.GoString(exceptionInfo.reason)) } C.DestroyImage(img) return newImg, nil }
// ReplaceImage Replaces the underlying image, freeing the old one func (im *MagickImage) ReplaceImage(new_image *C.Image) { C.DestroyImage(im.Image) im.Image = new_image }
func unrefImage(image *C.Image) { if atomic.AddInt32((*int32)(unsafe.Pointer(&image.client_data)), -1) == 0 { C.DestroyImage(image) } }