Exemple #1
0
func createChunk(mask, image *imagick.MagickWand, x, y int) error {
	if err := mask.CompositeImage(image, imagick.COMPOSITE_OP_SRC_IN, -x, -y); err != nil {
		return err
		// fmt.Sprintf("Chunking for (%d;%d) failed: %v", x, y, err)
	}

	if err := mask.WriteImage("tmp/" + strconv.Itoa(x) + "_" + strconv.Itoa(y) + ".png"); err != nil {
		return err
		// fmt.Sprintf("Saving chunk for (%d;%d) failed: %v", x, y, err)
	}
	return nil
}