예제 #1
0
파일: image.go 프로젝트: zesus19/nephele
/*
Sets the image quality factor, which determines compression options when saving the file

quality: The image quality
*/
func (this *Image) SetCompressionQuality(quality int) error {
	if this.magickWand == nil {
		return errors.New("error set image compression quality:magickwand is nil")
	}

	status := C.MagickSetCompressionQuality(this.magickWand, C.ulong(quality))
	if status == 0 {
		var etype int
		descr := C.MagickGetException(this.magickWand, (*C.ExceptionType)(unsafe.Pointer(&etype)))
		defer C.MagickRelinquishMemory(unsafe.Pointer(descr))
		return errors.New(fmt.Sprintf("error set image compression quality: %s (ExceptionType = %d)", C.GoString(descr), etype))
	}

	return nil
}
예제 #2
0
/*
Sets the image quality factor, which determines compression options when saving the file

quality: The image quality
*/
func (this *Image) SetCompressionQuality(quality int) error {
	var err error = nil
	tran := this.Cat.NewTransaction("GraphicsMagickCmd", "SetCompressionQuality")
	defer func() {
		tran.SetStatus(err)
		tran.Complete()
	}()
	if this.magickWand == nil {
		err = errors.New("error set image compression quality:magickwand is nil")
		return err
	}

	status := C.MagickSetCompressionQuality(this.magickWand, C.ulong(quality))
	if status == 0 {
		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 set image compression quality: %s (ExceptionType = %d)", C.GoString(descr), etype))
		return err
	}

	return nil
}
예제 #3
0
// Sets the wand compression quality.
func (mw *MagickWand) SetCompressionQuality(quality uint) error {
	C.MagickSetCompressionQuality(mw.mw, C.size_t(quality))
	return mw.GetLastError()
}
예제 #4
0
// Sets the wand compression quality.
func (mw *MagickWand) SetCompressionQuality(quality uint) error {
	ok := C.MagickSetCompressionQuality(mw.mw, C.size_t(quality))
	return mw.getLastErrorIfFailed(ok)
}