MCPcopy Create free account
hub / github.com/bolknote/go-gd / EncodeFile

Method EncodeFile

pkg/gd/io.go:240–251  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

238}
239
240func (im *Image) EncodeFile(path string) error {
241 ptr, err := im.cptr()
242 if err != nil {
243 return err
244 }
245 cpath := C.CString(path)
246 defer C.free(unsafe.Pointer(cpath))
247 if C.gdImageFile(ptr, cpath) == 0 {
248 return ErrEncode
249 }
250 return nil
251}
252
253func DecodePNG(data []byte) (*Image, error) {
254 return decodeBuffer(data, func(size C.int, ptr unsafe.Pointer) C.gdImagePtr {

Callers 1

Calls 1

cptrMethod · 0.95

Tested by 1