Created
June 6, 2016 15:01
-
-
Save theredstapler/327a3d23e89016f514cbc51f46242e5d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="jquery.min.js"></script> | |
<script src="fabric.min.js"></script> | |
<script src="FileSaver.min.js"></script> | |
<script src="canvas-toBlob.js"></script> | |
</head> | |
<body> | |
<canvas id="c" width="800" height="600"></canvas> | |
<input id="b" type="button" value="Save as Image" /> | |
<script> | |
var canvas = new fabric.Canvas('c'); | |
fabric.Image.fromURL('minion.png', function(img){ | |
img.setWidth(200); | |
img.setHeight(200); | |
canvas.add(img); | |
}); | |
$("#b").click(function(){ | |
$("#c").get(0).toBlob(function(blob){ | |
saveAs(blob, "myIMG.png"); | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment