func ImageToGifBuffer(p *Image) []byte { var imgSize int pimgSize := (*C.int)(Pointer(&imgSize)) buf := C.gdImageGifPtr(p.img, pimgSize) defer C.gdFree(buf) return C.GoBytes(buf, *pimgSize) }
func (p *gdImage) gdImageGif() ([]byte, error) { if p == nil { panic(imageError) } var size C.int data := C.gdImageGifPtr(p.img, &size) if data == nil || int(size) == 0 { return []byte{}, writeError } defer C.gdFree(unsafe.Pointer(data)) return C.GoBytes(data, size), nil }