Example #1
0
File: mage.go Project: dqminh/mage
// Public: export the current image into a blob. Also destroy the current wand
//
// Examples:
//  im = NewMage()
//  original, err := ioutil.ReadFile("test.jpg")
//  success := im.ReadBlob(original)
//  imageBytes := im.ExportBlob()
func (m *Mage) ExportBlob() []byte {
	defer m.Destroy()
	newSize := C.size_t(0)
	C.MagickResetIterator(m.wand)
	image := C.MagickGetImageBlob(m.wand, &newSize)
	imagePointer := unsafe.Pointer(image)
	defer C.MagickRelinquishMemory(imagePointer)
	return C.GoBytes(imagePointer, C.int(newSize))
}
Example #2
0
// Resets the wand iterator
func (w *MagickWand) ResetIterator() {
	C.MagickResetIterator(w.wand)
}
Example #3
0
// This method resets the wand iterator.
// It is typically used either before iterating though images, or before calling specific methods such as AppendImages()
// to append all images together.
// Afterward you can use NextImage() to iterate over all the images in a wand container, starting with the first image.
// Using this before AddImages() or ReadImages() will cause new images to be inserted between the first and second image.
func (mw *MagickWand) ResetIterator() {
	C.MagickResetIterator(mw.mw)
}