JSYG.CropAndResize.js
function(width,height) {
				
            var box = this.selection.getBBox();
						
            return JSYG(this.node).toCanvas()
            .then(function(canvas) {
				
                var maxWidth = canvas.getAttribute("width"),
                maxHeight = canvas.getAttribute("height"),
                x = Math.max(0,box.x),
                y = Math.max(0,box.y),
                boxWidth =  Math.min(maxWidth,box.width),
                boxHeight = Math.min(maxHeight,box.height);
				
                canvas = new Canvas(canvas);
									
                canvas = canvas.crop(x,y,boxWidth,boxHeight);
				
                if (width != null || height != null) canvas = canvas.resize(width,height);
				
                return canvas[0];
            });
        }
function(width,height) {
				
            var box = this.selection.getBBox();
						
            return JSYG(this.node).toCanvas()
            .then(function(canvas) {
				
                var maxWidth = canvas.getAttribute("width"),
                maxHeight = canvas.getAttribute("height"),
                x = Math.max(0,box.x),
                y = Math.max(0,box.y),
                boxWidth =  Math.min(maxWidth,box.width),
                boxHeight = Math.min(maxHeight,box.height);
				
                canvas = new Canvas(canvas);
									
                canvas = canvas.crop(x,y,boxWidth,boxHeight);
				
                if (width != null || height != null) canvas = canvas.resize(width,height);
				
                return canvas[0];
            });
        }
Exporte la sélection sous forme d'objet Canvas
@param width optionnel, largeur de l'image
@param height optionnel, hauteur de l'image
@returns {Promise}
@see Canvas