Example #1
0
/*
GetFormat() return format of this image
*/
func (this *Image) GetFormat() (string, error) {
	var err error = nil
	tran := this.Cat.NewTransaction("GraphicsMagickCmd", "GetFormat")
	defer func() {
		tran.SetStatus(err)
		tran.Complete()
	}()
	if this.magickWand == nil {
		err = errors.New("error get image format:magickwand is nil")
		return "", err
	}

	format := C.MagickGetImageFormat(this.magickWand)
	if format == nil {
		var etype int
		descr := C.MagickGetException(this.magickWand, (*C.ExceptionType)(unsafe.Pointer(&etype)))
		defer C.MagickRelinquishMemory(unsafe.Pointer(descr))
		err = errors.New(fmt.Sprintf("error get image format: %s (ExceptionType = %d)", C.GoString(descr), etype))
		return "", err
	}
	return C.GoString(format), nil
}
Example #2
0
func (self *Canvas) Format() string {
	ptr := C.MagickGetImageFormat(self.wand)
	defer C.free(unsafe.Pointer(ptr))

	return C.GoString(ptr)
}
Example #3
0
// Returns image format
func (self Canvas) Format() string {
	return C.GoString(C.MagickGetImageFormat(self.wand))
}
Example #4
0
/* Gets the format of a particular image in a sequence. */
func (w *MagickWand) ImageFormat() string {
	return C.GoString(C.MagickGetImageFormat(w.wand))
}
Example #5
0
func (cv Canvas) Format() string {
	format := C.MagickGetImageFormat(cv.wand)
	return strings.Trim(C.GoString(format), " ")
}