예제 #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
}
예제 #2
0
파일: canvas.go 프로젝트: phacops/canvas
func (self *Canvas) Format() string {
	ptr := C.MagickGetImageFormat(self.wand)
	defer C.free(unsafe.Pointer(ptr))

	return C.GoString(ptr)
}
예제 #3
0
파일: canvas.go 프로젝트: Yuras/canvas
// Returns image format
func (self Canvas) Format() string {
	return C.GoString(C.MagickGetImageFormat(self.wand))
}
예제 #4
0
/* Gets the format of a particular image in a sequence. */
func (w *MagickWand) ImageFormat() string {
	return C.GoString(C.MagickGetImageFormat(w.wand))
}
예제 #5
0
파일: canvas.go 프로젝트: vuleetu/canvas
func (cv Canvas) Format() string {
	format := C.MagickGetImageFormat(cv.wand)
	return strings.Trim(C.GoString(format), " ")
}