// SetProperty() saves the given string value either to specific known // attribute or to a freeform property string on the underlying Image func (im *MagickImage) SetProperty(prop, value string) (err error) { c_prop := C.CString(prop) defer C.free(unsafe.Pointer(c_prop)) c_value := C.CString(value) defer C.free(unsafe.Pointer(c_value)) ok := C.SetImageProperty(im.Image, c_prop, c_value) if ok == C.MagickFalse { return &MagickError{"error", "", "could not set property"} } return }
func (im *Image) setProperty(key string, value *C.char) bool { k := C.CString(key) var ret bool if value == nil { ret = C.DeleteImageProperty(im.image, k) != 0 } else { C.DeleteImageProperty(im.image, k) ret = C.SetImageProperty(im.image, k, value) != 0 } C.free(unsafe.Pointer(k)) return ret }